diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-04-18 01:34:40 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-08-25 13:08:18 +0200 |
commit | 346ace4c2f5e020ca654541ff4b34d86faf88a4d (patch) | |
tree | aa9debbc4d1f47fd22b31010b99a55bb538b7c58 | |
parent | e507800e47973422c080a308955f8d46edc5d706 (diff) |
libdiskfs: rename `error' variable
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Rename `error' to `err'.
* libdiskfs/file-getcontrol.c (diskfs_S_file_getcontrol): Likewise.
* libdiskfs/file-syncfs.c (diskfs_S_file_syncfs): Likewise.
-rw-r--r-- | libdiskfs/dir-lookup.c | 104 | ||||
-rw-r--r-- | libdiskfs/file-getcontrol.c | 14 | ||||
-rw-r--r-- | libdiskfs/file-syncfs.c | 6 |
3 files changed, 62 insertions, 62 deletions
diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c index f3364cd6..75df9b80 100644 --- a/libdiskfs/dir-lookup.c +++ b/libdiskfs/dir-lookup.c @@ -43,7 +43,7 @@ diskfs_S_dir_lookup (struct protid *dircred, char *nextname; char *relpath; int nextnamelen; - error_t error = 0; + error_t err = 0; char *pathbuf = 0; int pathbuflen = 0; int newnamelen; @@ -132,16 +132,16 @@ diskfs_S_dir_lookup (struct protid *dircred, { if (!ds) ds = alloca (diskfs_dirstat_size); - error = diskfs_lookup (dnp, path, CREATE, &np, ds, dircred); + err = diskfs_lookup (dnp, path, CREATE, &np, ds, dircred); } else - error = diskfs_lookup (dnp, path, LOOKUP, &np, 0, dircred); + err = diskfs_lookup (dnp, path, LOOKUP, &np, 0, dircred); - if (lastcomp && create && excl && (!error || error == EAGAIN)) - error = EEXIST; + if (lastcomp && create && excl && (!err || err == EAGAIN)) + err = EEXIST; /* If we get an error we're done */ - if (error == EAGAIN) + if (err == EAGAIN) { if (dnp == dircred->po->shadow_root) /* We're at the root of a shadow tree. */ @@ -151,7 +151,7 @@ diskfs_S_dir_lookup (struct protid *dircred, /* This is a shadow root with no parent, meaning we should treat it as a virtual root disconnected from its real .. directory. */ - error = 0; + err = 0; np = dnp; diskfs_nref (np); } @@ -163,7 +163,7 @@ diskfs_S_dir_lookup (struct protid *dircred, *returned_port_poly = MACH_MSG_TYPE_COPY_SEND; if (! lastcomp) strcpy (retryname, nextname); - error = 0; + err = 0; goto out; } } @@ -177,13 +177,13 @@ diskfs_S_dir_lookup (struct protid *dircred, *returned_port_poly = MACH_MSG_TYPE_COPY_SEND; if (!lastcomp) strcpy (retryname, nextname); - error = 0; + err = 0; goto out; } else /* We're at a REAL root, as in there's no way up from here. */ { - error = 0; + err = 0; np = dnp; diskfs_nref (np); } @@ -192,11 +192,11 @@ diskfs_S_dir_lookup (struct protid *dircred, /* Create the new node if necessary */ if (lastcomp && create) { - if (error == ENOENT) + if (err == ENOENT) { mode &= ~(S_IFMT | S_ISPARE | S_ISVTX | S_ITRANS); mode |= S_IFREG; - error = diskfs_create_node (dnp, path, mode, &np, dircred, ds); + err = diskfs_create_node (dnp, path, mode, &np, dircred, ds); if (diskfs_synchronous) { diskfs_file_update (dnp, 1); @@ -208,7 +208,7 @@ diskfs_S_dir_lookup (struct protid *dircred, diskfs_drop_dirstat (dnp, ds); } - if (error) + if (err) goto out; /* If this is translated, start the translator (if necessary) @@ -260,21 +260,21 @@ diskfs_S_dir_lookup (struct protid *dircred, /* Create an unauthenticated port for DNP, and then unlock it. */ - error = iohelp_create_empty_iouser (&user); - if (! error) + err = iohelp_create_empty_iouser (&user); + if (! err) { - error = diskfs_make_peropen (dnp, 0, dircred->po, &newpo); - if (! error) + err = diskfs_make_peropen (dnp, 0, dircred->po, &newpo); + if (! err) { - error = diskfs_create_protid (newpo, user, &newpi); - if (! error) + err = diskfs_create_protid (newpo, user, &newpi); + if (! err) newpo = 0; } iohelp_free_iouser (user); } - if (error) + if (err) goto out; dirport = ports_get_send_right (newpi); @@ -288,7 +288,7 @@ diskfs_S_dir_lookup (struct protid *dircred, boolean_t register_translator = np->transbox.active == MACH_PORT_NULL; - error = fshelp_fetch_root (&np->transbox, dircred->po, + err = fshelp_fetch_root (&np->transbox, dircred->po, dirport, dircred->user, lastcomp ? flags : 0, ((np->dn_stat.st_mode & S_IPTRANS) @@ -301,10 +301,10 @@ diskfs_S_dir_lookup (struct protid *dircred, deallocate our send right. */ mach_port_deallocate (mach_task_self (), dirport); - if (error != ENOENT) + if (err != ENOENT) { *returned_port_poly = MACH_MSG_TYPE_MOVE_SEND; - if (!lastcomp && !error) + if (!lastcomp && !err) { char *end = strchr (retryname, '\0'); *end++ = '/'; @@ -333,12 +333,12 @@ diskfs_S_dir_lookup (struct protid *dircred, else asprintf (&complete_path, "%s/%s", dircred->po->path, translator_path); - error = fshelp_set_active_translator (&newpi->pi, + err = fshelp_set_active_translator (&newpi->pi, complete_path, np->transbox.active); if (complete_path != translator_path) free(complete_path); - if (error) + if (err) goto out; } @@ -351,7 +351,7 @@ diskfs_S_dir_lookup (struct protid *dircred, /* ENOENT means there was a hiccup, and the translator vanished while NP was unlocked inside fshelp_fetch_root. Reacquire the locks, and continue as normal. */ - error = 0; + err = 0; if (np != dnp) { if (!strcmp (path, "..")) @@ -377,7 +377,7 @@ diskfs_S_dir_lookup (struct protid *dircred, if (nsymlink++ > diskfs_maxsymlinks) { - error = ELOOP; + err = ELOOP; goto out; } @@ -390,16 +390,16 @@ diskfs_S_dir_lookup (struct protid *dircred, } if (diskfs_read_symlink_hook) - error = (*diskfs_read_symlink_hook)(np, pathbuf); - if (!diskfs_read_symlink_hook || error == EINVAL) + err = (*diskfs_read_symlink_hook)(np, pathbuf); + if (!diskfs_read_symlink_hook || err == EINVAL) { - error = diskfs_node_rdwr (np, pathbuf, + err = diskfs_node_rdwr (np, pathbuf, 0, np->dn_stat.st_size, 0, dircred, &amt); - if (!error) + if (!err) assert (amt == np->dn_stat.st_size); } - if (error) + if (err) goto out; if (np->dn_stat.st_size == 0) /* symlink to "" */ @@ -471,7 +471,7 @@ diskfs_S_dir_lookup (struct protid *dircred, if (mustbedir && type != S_IFDIR) { - error = ENOTDIR; + err = ENOTDIR; goto out; } @@ -482,25 +482,25 @@ diskfs_S_dir_lookup (struct protid *dircred, type == S_IFIFO) && (flags & (O_READ|O_WRITE|O_EXEC))) || (type == S_IFLNK && (flags & (O_WRITE|O_EXEC)))) - error = EACCES; + err = EACCES; - if (!error && (flags & O_READ)) - error = fshelp_access (&np->dn_stat, S_IREAD, dircred->user); + if (!err && (flags & O_READ)) + err = fshelp_access (&np->dn_stat, S_IREAD, dircred->user); - if (!error && (flags & O_EXEC)) - error = fshelp_access (&np->dn_stat, S_IEXEC, dircred->user); + if (!err && (flags & O_EXEC)) + err = fshelp_access (&np->dn_stat, S_IEXEC, dircred->user); - if (!error && (flags & O_WRITE)) + if (!err && (flags & O_WRITE)) { if (type == S_IFDIR) - error = EISDIR; + err = EISDIR; else if (diskfs_check_readonly ()) - error = EROFS; + err = EROFS; else - error = fshelp_access (&np->dn_stat, S_IWRITE, dircred->user); + err = fshelp_access (&np->dn_stat, S_IWRITE, dircred->user); } - if (error) + if (err) goto out; } @@ -508,24 +508,24 @@ diskfs_S_dir_lookup (struct protid *dircred, && (fshelp_isowner (&np->dn_stat, dircred->user) == EPERM)) flags &= ~O_NOATIME; - error = diskfs_make_peropen (np, (flags &~OPENONLY_STATE_MODES), + err = diskfs_make_peropen (np, (flags &~OPENONLY_STATE_MODES), dircred->po, &newpo); - if (! error) - error = diskfs_create_protid (newpo, dircred->user, &newpi); + if (! err) + err = diskfs_create_protid (newpo, dircred->user, &newpi); - if (! error) + if (! err) { newpo = 0; if (flags & O_EXLOCK) - error = fshelp_acquire_lock (&np->userlock, &newpi->po->lock_status, + err = fshelp_acquire_lock (&np->userlock, &newpi->po->lock_status, &np->lock, LOCK_EX); else if (flags & O_SHLOCK) - error = fshelp_acquire_lock (&np->userlock, &newpi->po->lock_status, + err = fshelp_acquire_lock (&np->userlock, &newpi->po->lock_status, &np->lock, LOCK_SH); } - if (! error) + if (! err) { free (newpi->po->path); if (dircred->po->path == NULL || !strcmp (dircred->po->path,".")) @@ -541,7 +541,7 @@ diskfs_S_dir_lookup (struct protid *dircred, } if (! newpi->po->path) - error = errno; + err = errno; *returned_port = ports_get_right (newpi); ports_port_deref (newpi); @@ -566,5 +566,5 @@ diskfs_S_dir_lookup (struct protid *dircred, free (relpath); - return error; + return err; } diff --git a/libdiskfs/file-getcontrol.c b/libdiskfs/file-getcontrol.c index fc6f777e..8f98f4b3 100644 --- a/libdiskfs/file-getcontrol.c +++ b/libdiskfs/file-getcontrol.c @@ -25,20 +25,20 @@ diskfs_S_file_getcontrol (struct protid *cred, mach_port_t *control, mach_msg_type_name_t *controltype) { - int error; + error_t err; struct port_info *newpi; if (!cred) return EOPNOTSUPP; - error = fshelp_iscontroller (&diskfs_root_node->dn_stat, cred->user); - if (error) - return error; + err = fshelp_iscontroller (&diskfs_root_node->dn_stat, cred->user); + if (err) + return err; - error = ports_create_port (diskfs_control_class, diskfs_port_bucket, + err = ports_create_port (diskfs_control_class, diskfs_port_bucket, sizeof (struct port_info), &newpi); - if (error) - return error; + if (err) + return err; pthread_spin_lock (&_diskfs_control_lock); _diskfs_ncontrol_ports++; diff --git a/libdiskfs/file-syncfs.c b/libdiskfs/file-syncfs.c index b7d20a88..2faab6ad 100644 --- a/libdiskfs/file-syncfs.c +++ b/libdiskfs/file-syncfs.c @@ -28,12 +28,12 @@ diskfs_S_file_syncfs (struct protid *cred, error_t helper (struct node *np) { - error_t error; + error_t err; mach_port_t control; - error = fshelp_fetch_control (&np->transbox, &control); + err = fshelp_fetch_control (&np->transbox, &control); pthread_mutex_unlock (&np->lock); - if (!error && (control != MACH_PORT_NULL)) + if (!err && (control != MACH_PORT_NULL)) { fsys_syncfs (control, wait, 1); mach_port_deallocate (mach_task_self (), control); |