1 |
/* Libnetfs callbacks for node operations in NFS client |
/* Libnetfs callbacks for node operations in NFS client |
2 |
Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation |
Copyright (C) 1994,95,96,97,99,2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
5 |
modify it under the terms of the GNU General Public License as |
modify it under the terms of the GNU General Public License as |
21 |
#include <string.h> |
#include <string.h> |
22 |
#include <fcntl.h> |
#include <fcntl.h> |
23 |
#include <stdio.h> |
#include <stdio.h> |
24 |
|
#include <stddef.h> |
25 |
#include <dirent.h> |
#include <dirent.h> |
26 |
#include <unistd.h> |
#include <unistd.h> |
27 |
#include <maptime.h> |
#include <maptime.h> |
89 |
else |
else |
90 |
{ |
{ |
91 |
int attrs_exist; |
int attrs_exist; |
92 |
|
|
93 |
attrs_exist = ntohl (*p++); |
attrs_exist = ntohl (*p++); |
94 |
if (attrs_exist) |
if (attrs_exist) |
95 |
p = register_fresh_stat (np, p); |
p = register_fresh_stat (np, p); |
291 |
error_t err; |
error_t err; |
292 |
struct timeval tv; |
struct timeval tv; |
293 |
struct timespec current; |
struct timespec current; |
294 |
|
|
295 |
/* XXX For version 3 we can actually do this right, but we don't |
/* XXX For version 3 we can actually do this right, but we don't |
296 |
just yet. */ |
just yet. */ |
297 |
if (!atime || !mtime) |
if (!atime || !mtime) |
307 |
return errno; |
return errno; |
308 |
|
|
309 |
p = xdr_encode_fhandle (p, &np->nn->handle); |
p = xdr_encode_fhandle (p, &np->nn->handle); |
310 |
p = xdr_encode_sattr_times (p, |
p = xdr_encode_sattr_times (p, |
311 |
atime ?: ¤t, |
atime ?: ¤t, |
312 |
mtime ?: ¤t); |
mtime ?: ¤t); |
313 |
if (protocol_version == 3) |
if (protocol_version == 3) |
314 |
*p++ = 0; /* guard check == 0 */ |
*p++ = 0; /* guard check == 0 */ |
1223 |
away entirely. */ |
away entirely. */ |
1224 |
if (np->references > 1) |
if (np->references > 1) |
1225 |
{ |
{ |
1226 |
char *newname; |
char *newname = 0; |
1227 |
int n = 0; |
int n = 0; |
1228 |
|
|
1229 |
mutex_unlock (&dir->lock); |
mutex_unlock (&dir->lock); |
1238 |
|
|
1239 |
do |
do |
1240 |
{ |
{ |
1241 |
sprintf (newname, ".nfs%xgnu.%d", (int) np, n++); |
sprintf (newname, ".nfs%txgnu.%d", (ptrdiff_t) np, n++); |
1242 |
err = netfs_attempt_link (cred, dir, np, newname, 1); |
err = netfs_attempt_link (cred, dir, np, newname, 1); |
1243 |
} |
} |
1244 |
while (err == EEXIST); |
while (err == EEXIST); |