diff --git a/libdiskfs/dir-link.c b/libdiskfs/dir-link.c index 45d8894..ca5dd56 100644 --- a/libdiskfs/dir-link.c +++ b/libdiskfs/dir-link.c @@ -29,7 +29,7 @@ diskfs_S_dir_link (struct protid *dircred, struct node *tnp; /* node being deleted implicitly */ struct node *dnp; /* directory of new entry */ struct dirstat *ds = alloca (diskfs_dirstat_size); - error_t error; + error_t err; if (!dircred) return EOPNOTSUPP; @@ -53,19 +53,19 @@ diskfs_S_dir_link (struct protid *dircred, pthread_mutex_lock (&dnp->lock); /* Lookup new location */ - error = diskfs_lookup (dnp, name, RENAME, &tnp, ds, dircred); - if (!error && excl) + err = diskfs_lookup (dnp, name, RENAME, &tnp, ds, dircred); + if (!err && excl) { - error = EEXIST; + err = EEXIST; diskfs_nput (tnp); } - if (error && error != ENOENT) + if (err && err != ENOENT) { - if (error == EAGAIN) - error = EINVAL; + if (err == EAGAIN) + err = EINVAL; diskfs_drop_dirstat (dnp, ds); pthread_mutex_unlock (&dnp->lock); - return error; + return err; } if (np == tnp) @@ -107,8 +107,8 @@ diskfs_S_dir_link (struct protid *dircred, if (tnp) { assert (!excl); - error = diskfs_dirrewrite (dnp, tnp, np, name, ds); - if (!error) + err = diskfs_dirrewrite (dnp, tnp, np, name, ds); + if (!err) { /* Deallocate link on TNP */ tnp->dn_stat.st_nlink--; @@ -119,15 +119,15 @@ diskfs_S_dir_link (struct protid *dircred, diskfs_nput (tnp); } else - error = diskfs_direnter (dnp, name, np, ds, dircred); + err = diskfs_direnter (dnp, name, np, ds, dircred); if (diskfs_synchronous) diskfs_node_update (dnp, 1); pthread_mutex_unlock (&dnp->lock); pthread_mutex_unlock (&np->lock); - if (!error) + if (!err) /* MiG won't do this for us, which it ought to. */ mach_port_deallocate (mach_task_self (), filecred->pi.port_right); - return error; + return err; } diff --git a/libdiskfs/dir-unlink.c b/libdiskfs/dir-unlink.c index f687a16..cf02c22 100644 --- a/libdiskfs/dir-unlink.c +++ b/libdiskfs/dir-unlink.c @@ -27,7 +27,7 @@ diskfs_S_dir_unlink (struct protid *dircred, struct node *dnp; struct node *np; struct dirstat *ds = alloca (diskfs_dirstat_size); - error_t error; + error_t err; mach_port_t control = MACH_PORT_NULL; if (!dircred) @@ -39,14 +39,14 @@ diskfs_S_dir_unlink (struct protid *dircred, pthread_mutex_lock (&dnp->lock); - error = diskfs_lookup (dnp, name, REMOVE, &np, ds, dircred); - if (error == EAGAIN) - error = EPERM; /* 1003.1-1996 5.5.1.4 */ - if (error) + err = diskfs_lookup (dnp, name, REMOVE, &np, ds, dircred); + if (err == EAGAIN) + err = EPERM; /* 1003.1-1996 5.5.1.4 */ + if (err) { diskfs_drop_dirstat (dnp, ds); pthread_mutex_unlock (&dnp->lock); - return error; + return err; } /* This isn't the BSD behavior, but it is Posix compliant and saves @@ -62,14 +62,14 @@ diskfs_S_dir_unlink (struct protid *dircred, return EPERM; /* 1003.1-1996 5.5.1.4 */ } - error = diskfs_dirremove (dnp, np, name, ds); + err = diskfs_dirremove (dnp, np, name, ds); if (diskfs_synchronous) diskfs_node_update (dnp, 1); - if (error) + if (err) { diskfs_nput (np); pthread_mutex_unlock (&dnp->lock); - return error; + return err; } np->dn_stat.st_nlink--; @@ -94,5 +94,5 @@ diskfs_S_dir_unlink (struct protid *dircred, mach_port_deallocate (mach_task_self (), control); } - return error; + return err; } diff --git a/libdiskfs/file-get-trans.c b/libdiskfs/file-get-trans.c index 11ed439..db5bbda 100644 --- a/libdiskfs/file-get-trans.c +++ b/libdiskfs/file-get-trans.c @@ -28,7 +28,7 @@ diskfs_S_file_get_translator (struct protid *cred, size_t *translen) { struct node *np; - error_t error = 0; + error_t err = 0; if (!cred) return EOPNOTSUPP; @@ -48,16 +48,16 @@ diskfs_S_file_get_translator (struct protid *cred, bcopy (_HURD_SYMLINK, *trans, sizeof _HURD_SYMLINK); if (diskfs_read_symlink_hook) - error = (*diskfs_read_symlink_hook) (np, + err = (*diskfs_read_symlink_hook) (np, *trans + sizeof _HURD_SYMLINK); - if (!diskfs_read_symlink_hook || error == EINVAL) + if (!diskfs_read_symlink_hook || err == EINVAL) { - error = diskfs_node_rdwr (np, *trans + sizeof _HURD_SYMLINK, + err = diskfs_node_rdwr (np, *trans + sizeof _HURD_SYMLINK, 0, np->dn_stat.st_size, 0, cred, &amt); - if (!error) + if (!err) assert (amt == np->dn_stat.st_size); } - if (!error) + if (!err) { (*trans)[sizeof _HURD_SYMLINK + np->dn_stat.st_size] = '\0'; *translen = len; @@ -88,7 +88,7 @@ diskfs_S_file_get_translator (struct protid *cred, bcopy (buf, *trans, buflen); free (buf); *translen = buflen; - error = 0; + err = 0; } else if (S_ISFIFO (np->dn_stat.st_mode)) { @@ -99,7 +99,7 @@ diskfs_S_file_get_translator (struct protid *cred, *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); bcopy (_HURD_FIFO, *trans, sizeof _HURD_FIFO); *translen = len; - error = 0; + err = 0; } else if (S_ISSOCK (np->dn_stat.st_mode)) { @@ -110,18 +110,18 @@ diskfs_S_file_get_translator (struct protid *cred, *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); bcopy (_HURD_IFSOCK, *trans, sizeof _HURD_IFSOCK); *translen = len; - error = 0; + err = 0; } else { if (! (np->dn_stat.st_mode & S_IPTRANS)) - error = EINVAL; + err = EINVAL; else { char *string; u_int len; - error = diskfs_get_translator (np, &string, &len); - if (!error) + err = diskfs_get_translator (np, &string, &len); + if (!err) { if (len > *translen) *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); @@ -134,5 +134,5 @@ diskfs_S_file_get_translator (struct protid *cred, pthread_mutex_unlock (&np->lock); - return error; + return err; } diff --git a/libdiskfs/file-get-transcntl.c b/libdiskfs/file-get-transcntl.c index c7fad91..311d23e 100644 --- a/libdiskfs/file-get-transcntl.c +++ b/libdiskfs/file-get-transcntl.c @@ -25,7 +25,7 @@ diskfs_S_file_get_translator_cntl (struct protid *cred, mach_msg_type_name_t *ctltype) { struct node *np; - error_t error; + error_t err; if (!cred) return EOPNOTSUPP; @@ -34,15 +34,15 @@ diskfs_S_file_get_translator_cntl (struct protid *cred, pthread_mutex_lock (&np->lock); - error = fshelp_isowner (&np->dn_stat, cred->user); - if (!error) - error = fshelp_fetch_control (&np->transbox, ctl); - if (!error && *ctl == MACH_PORT_NULL) - error = ENXIO; - if (!error) + err = fshelp_isowner (&np->dn_stat, cred->user); + if (!err) + err = fshelp_fetch_control (&np->transbox, ctl); + if (!err && *ctl == MACH_PORT_NULL) + err = ENXIO; + if (!err) *ctltype = MACH_MSG_TYPE_MOVE_SEND; pthread_mutex_unlock (&np->lock); - return error; + return err; } diff --git a/libdiskfs/file-set-trans.c b/libdiskfs/file-set-trans.c index 58f6255..6e1a61d 100644 --- a/libdiskfs/file-set-trans.c +++ b/libdiskfs/file-set-trans.c @@ -32,7 +32,7 @@ diskfs_S_file_set_translator (struct protid *cred, fsys_t active) { struct node *np; - error_t error; + error_t err; mach_port_t control = MACH_PORT_NULL; if (!cred) @@ -51,32 +51,32 @@ diskfs_S_file_set_translator (struct protid *cred, pthread_mutex_lock (&np->lock); - error = fshelp_isowner (&np->dn_stat, cred->user); - if (error) + err = fshelp_isowner (&np->dn_stat, cred->user); + if (err) { pthread_mutex_unlock (&np->lock); - return error; + return err; } if ((active_flags & FS_TRANS_SET) && ! (active_flags & FS_TRANS_ORPHAN)) { - error = fshelp_fetch_control (&np->transbox, &control); - if (error) + err = fshelp_fetch_control (&np->transbox, &control); + if (err) { pthread_mutex_unlock (&np->lock); - return error; + return err; } if ((control != MACH_PORT_NULL) && ((active_flags & FS_TRANS_EXCL) == 0)) { pthread_mutex_unlock (&np->lock); - error = fsys_goaway (control, killtrans_flags); + err = fsys_goaway (control, killtrans_flags); mach_port_deallocate (mach_task_self (), control); - if (error && (error != MIG_SERVER_DIED) - && (error != MACH_SEND_INVALID_DEST)) - return error; - error = 0; + if (err && (err != MIG_SERVER_DIED) + && (err != MACH_SEND_INVALID_DEST)) + return err; + err = 0; pthread_mutex_lock (&np->lock); } else if (control != MACH_PORT_NULL) @@ -94,12 +94,12 @@ diskfs_S_file_set_translator (struct protid *cred, if (active_flags & FS_TRANS_SET) { - error = fshelp_set_active (&np->transbox, active, + err = fshelp_set_active (&np->transbox, active, active_flags & FS_TRANS_EXCL); - if (error) + if (err) { pthread_mutex_unlock (&np->lock); - return error; + return err; } } @@ -158,12 +158,12 @@ diskfs_S_file_set_translator (struct protid *cred, } minor = strtol (arg, 0, 0); - error = diskfs_validate_rdev_change (np, + err = diskfs_validate_rdev_change (np, makedev (major, minor)); - if (error) + if (err) { pthread_mutex_unlock (&np->lock); - return error; + return err; } np->dn_stat.st_rdev = makedev (major, minor); } @@ -180,36 +180,36 @@ diskfs_S_file_set_translator (struct protid *cred, } if (diskfs_create_symlink_hook) - error = (*diskfs_create_symlink_hook)(np, arg); - if (!diskfs_create_symlink_hook || error == EINVAL) + err = (*diskfs_create_symlink_hook)(np, arg); + if (!diskfs_create_symlink_hook || err == EINVAL) /* Store the argument in the file as the target of the link */ - error = diskfs_node_rdwr (np, arg, 0, strlen (arg), + err = diskfs_node_rdwr (np, arg, 0, strlen (arg), 1, cred, 0); - if (error) + if (err) { pthread_mutex_unlock (&np->lock); - return error; + return err; } } newmode = (np->dn_stat.st_mode & ~S_IFMT) | newmode; - error = diskfs_validate_mode_change (np, newmode); - if (!error) + err = diskfs_validate_mode_change (np, newmode); + if (!err) { np->dn_stat.st_mode = newmode; diskfs_node_update (np, diskfs_synchronous); } pthread_mutex_unlock (&np->lock); - return error; + return err; } } - error = diskfs_set_translator (np, passive, passivelen, cred); + err = diskfs_set_translator (np, passive, passivelen, cred); } pthread_mutex_unlock (&np->lock); - if (! error && cred->po->path && active_flags & FS_TRANS_SET) - error = fshelp_set_active_translator (&cred->pi, cred->po->path, active); + if (! err && cred->po->path && active_flags & FS_TRANS_SET) + err = fshelp_set_active_translator (&cred->pi, cred->po->path, active); - return error; + return err; } diff --git a/libdiskfs/fsys-getroot.c b/libdiskfs/fsys-getroot.c index 39973a8..85e1167 100644 --- a/libdiskfs/fsys-getroot.c +++ b/libdiskfs/fsys-getroot.c @@ -42,7 +42,7 @@ diskfs_S_fsys_getroot (fsys_t controlport, { struct port_info *pt = ports_lookup_port (diskfs_port_bucket, controlport, diskfs_control_class); - error_t error = 0; + error_t err = 0; mode_t type; struct protid *newpi; struct peropen *newpo; @@ -79,23 +79,23 @@ diskfs_S_fsys_getroot (fsys_t controlport, || fshelp_translated (&diskfs_root_node->transbox)) && !(flags & O_NOTRANS)) { - error = fshelp_fetch_root (&diskfs_root_node->transbox, + err = fshelp_fetch_root (&diskfs_root_node->transbox, &peropen_context, dotdot, &user, flags, _diskfs_translator_callback1, _diskfs_translator_callback2, retry, retryname, returned_port); - if (error != ENOENT) + if (err != ENOENT) { pthread_mutex_unlock (&diskfs_root_node->lock); pthread_rwlock_unlock (&diskfs_fsys_lock); drop_idvec (); - if (!error) + if (!err) *returned_port_poly = MACH_MSG_TYPE_MOVE_SEND; - return error; + return err; } /* ENOENT means the translator was removed in the interim. */ - error = 0; + err = 0; } if (type == S_IFLNK && !(flags & (O_NOLINK | O_NOTRANS))) @@ -105,19 +105,19 @@ diskfs_S_fsys_getroot (fsys_t controlport, size_t amt; if (diskfs_read_symlink_hook) - error = (*diskfs_read_symlink_hook) (diskfs_root_node, pathbuf); - if (!diskfs_read_symlink_hook || error == EINVAL) - error = diskfs_node_rdwr (diskfs_root_node, pathbuf, 0, + err = (*diskfs_read_symlink_hook) (diskfs_root_node, pathbuf); + if (!diskfs_read_symlink_hook || err == EINVAL) + err = diskfs_node_rdwr (diskfs_root_node, pathbuf, 0, diskfs_root_node->dn_stat.st_size, 0, 0, &amt); pathbuf[amt] = '\0'; pthread_mutex_unlock (&diskfs_root_node->lock); pthread_rwlock_unlock (&diskfs_fsys_lock); - if (error) + if (err) { drop_idvec (); - return error; + return err; } if (pathbuf[0] == '/') @@ -144,31 +144,31 @@ diskfs_S_fsys_getroot (fsys_t controlport, if ((type == S_IFSOCK || type == S_IFBLK || type == S_IFCHR || type == S_IFIFO) && (flags & (O_READ|O_WRITE|O_EXEC))) - error = EOPNOTSUPP; + err = EOPNOTSUPP; - if (!error && (flags & O_READ)) - error = fshelp_access (&diskfs_root_node->dn_stat, S_IREAD, &user); + if (!err && (flags & O_READ)) + err = fshelp_access (&diskfs_root_node->dn_stat, S_IREAD, &user); - if (!error && (flags & O_EXEC)) - error = fshelp_access (&diskfs_root_node->dn_stat, S_IEXEC, &user); + if (!err && (flags & O_EXEC)) + err = fshelp_access (&diskfs_root_node->dn_stat, S_IEXEC, &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 (&diskfs_root_node->dn_stat, + err = fshelp_access (&diskfs_root_node->dn_stat, S_IWRITE, &user); } - if (error) + if (err) { pthread_mutex_unlock (&diskfs_root_node->lock); pthread_rwlock_unlock (&diskfs_fsys_lock); drop_idvec (); - return error; + return err; } if ((flags & O_NOATIME) @@ -178,16 +178,16 @@ diskfs_S_fsys_getroot (fsys_t controlport, flags &= ~OPENONLY_STATE_MODES; - error = diskfs_make_peropen (diskfs_root_node, flags, + err = diskfs_make_peropen (diskfs_root_node, flags, &peropen_context, &newpo); - if (! error) + if (! err) { - error = diskfs_create_protid (newpo, &user, &newpi); - if (error) + err = diskfs_create_protid (newpo, &user, &newpi); + if (err) diskfs_release_peropen (newpo); } - if (! error) + if (! err) { mach_port_deallocate (mach_task_self (), dotdot); *retry = FS_RETRY_NORMAL; @@ -204,5 +204,5 @@ diskfs_S_fsys_getroot (fsys_t controlport, drop_idvec (); - return error; + return err; } diff --git a/libshouldbeinlibc/wire.c b/libshouldbeinlibc/wire.c index b954095..ca5d32b 100644 --- a/libshouldbeinlibc/wire.c +++ b/libshouldbeinlibc/wire.c @@ -139,10 +139,10 @@ wire_segment (vm_address_t start, vm_size_t len) { mach_port_t host, device; - error_t error; + error_t err; - error = get_privileged_ports (&host, &device); - if (!error) + err = get_privileged_ports (&host, &device); + if (!err) { wire_segment_internal (start, len, host); mach_port_deallocate (mach_task_self (), host); @@ -158,11 +158,11 @@ wire_task_self () { struct link_map *map; mach_port_t host, device; - error_t error; + error_t err; extern char _edata, _etext, __data_start; - error = get_privileged_ports (&host, &device); - if (error) + err = get_privileged_ports (&host, &device); + if (err) return; map = loaded ();