bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] libdiskfs: Code clean up


From: Neal H Walfield
Subject: [PATCH] libdiskfs: Code clean up
Date: Sat, 31 Mar 2001 10:11:33 +0200
User-agent: Mutt/1.3.15i

2001-03-28 Neal H Walfield  <neal@cs.uml.edu>

        * shutdown.c: Move initialization of diskfs_fsys_lock from here ...
        * init-init.c: ... to here with the rest of the initialization
        code.

        * init-init.c: Do not initialize global variables to zero.

        * protid-rele: Doc fix.
        * node-nput.c: Likewise.
        * io-prenotify.c: Likewise.

        * dir-chg.c (diskfs_S_dir_notice_changes): Check what malloc
        returns.
        * peropen-make.c (diskfs_make_peropen): Likewise.

        * io-identity.c (diskfs_S_io_identity): Use inum; that is what
        we bothered getting the lock for.

Also, ports-noports.c, ports-clean.c, ports-soft.c, ports-idle.c and
ports-consts.c are dead files that were never removed from CVS as
shown by this change log entry:

Tue Jun  6 13:50:13 1995  Michael I Bushnell <mib@duality.gnu.ai.mit.edu>

        * ports-noports.c, ports-clean.c, ports-soft.c, ports-idle.c,
        ports-consts.c, pager-consts.c, init-loop.c: Deleted files.
        * Makefile (OTHERSRCS): Deleted ports-noports.c, ports-clean.c,
        ports-soft.c, ports-consts, pager-consts.c, init-loop.c, and
        ports-idle.c.



--- hurd-20010329-snapshot/libdiskfs/shutdown.c Sat Oct 23 20:12:34 1999
+++ hurd-20010329/libdiskfs/shutdown.c  Sat Mar 31 09:48:39 2001
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1993, 94, 95, 96, 98, 99 Free Software Foundation, Inc.
+   Copyright (C) 1993,94,95,96,98,99,2001 Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -21,8 +21,6 @@
 
 #include "priv.h"
 #include <hurd/fsys.h>
-
-struct rwlock diskfs_fsys_lock = RWLOCK_INITIALIZER;
 
 /* Shutdown the filesystem; flags are as for fsys_goaway. */
 error_t
--- hurd-20010329-snapshot/libdiskfs/init-init.c        Sun Sep 19 23:13:27 1999
+++ hurd-20010329/libdiskfs/init-init.c Sat Mar 31 09:56:41 2001
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1994, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+   Copyright (C) 1994, 95, 96, 97, 98, 99, 2001 Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -28,6 +28,8 @@
 mach_port_t diskfs_default_pager;
 mach_port_t diskfs_auth_server_port;
 volatile struct mapped_time_value *diskfs_mtime;
+
+struct rwlock diskfs_fsys_lock = RWLOCK_INITIALIZER;
 mach_port_t diskfs_fsys_identity;
 
 int _diskfs_nosuid, _diskfs_noexec;
@@ -38,7 +40,7 @@
 spin_lock_t diskfs_node_refcnt_lock = SPIN_LOCK_INITIALIZER;
 
 spin_lock_t _diskfs_control_lock = SPIN_LOCK_INITIALIZER;
-int _diskfs_ncontrol_ports = 0;
+int _diskfs_ncontrol_ports;
 
 struct port_class *diskfs_protid_class;
 struct port_class *diskfs_control_class;
--- hurd-20010329-snapshot/libdiskfs/protid-rele.c      Sun Jul  4 01:50:16 1999
+++ hurd-20010329/libdiskfs/protid-rele.c       Fri Mar 30 16:07:59 2001
@@ -17,7 +17,7 @@
 
 #include "priv.h"
 
-/* Called when a protid CRED has no more references.  (Because references\
+/* Called when a protid CRED has no more references.  (Because references
    to protids are maintained by the port management library, this is 
    installed in the clean routines list.)  The ports library will
    free the structure for us.  */
--- hurd-20010329-snapshot/libdiskfs/node-nput.c        Thu Oct 28 08:27:10 1999
+++ hurd-20010329/libdiskfs/node-nput.c Sat Mar 31 09:53:03 2001
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    Written by Thomas Bushnell, BSG.
 
    This file is part of the GNU Hurd.
@@ -22,7 +22,7 @@
 
 /* Unlock node NP and release a hard reference; if this is the last
    hard reference and there are no links to the file then request
-   soft references to be dropped.  */
+   weak references to be dropped.  */
 void
 diskfs_nput (struct node *np)
 {
--- hurd-20010329-snapshot/libdiskfs/io-prenotify.c     Mon Aug 10 19:42:37 1998
+++ hurd-20010329/libdiskfs/io-prenotify.c      Sat Mar 31 09:52:51 2001
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1994, 1995, 1996 Free Software Foundation
+   Copyright (C) 1994, 1995, 1996, 2001 Free Software Foundation
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -22,7 +22,7 @@
 
    We set the prenotify size to be the allocated size of the file;
    then users are forced to call this routine before writing past
-   that, and we can do allocation (orreturn ENOSPC if necessary. */
+   that, and we can do allocation (or return ENOSPC if necessary). */
 kern_return_t
 diskfs_S_io_prenotify (struct protid *cred,
                       vm_offset_t start __attribute__ ((unused)),
--- hurd-20010329-snapshot/libdiskfs/dir-chg.c  Sat Oct 24 09:49:51 1998
+++ hurd-20010329/libdiskfs/dir-chg.c   Sat Mar 31 09:47:26 2001
@@ -1,5 +1,5 @@
 /* Notifications of directory changes.
-   Copyright (C) 1994, 1995, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1998, 2001 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -44,6 +44,11 @@
       return err;
     }
   req = malloc (sizeof (struct modreq));
+  if (! req)
+    {
+      mutex_unlock (&np->lock);
+      return ENOMEM;
+    }
   req->port = notify;
   req->next = np->dirmod_reqs;
   np->dirmod_reqs = req;
--- hurd-20010329-snapshot/libdiskfs/peropen-make.c     Sat Feb 13 10:39:13 1999
+++ hurd-20010329/libdiskfs/peropen-make.c      Fri Mar 30 16:07:33 2001
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1994, 1997, 1999 Free Software Foundation
+   Copyright (C) 1994, 1997, 1999, 2001 Free Software Foundation
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -24,6 +24,9 @@
 diskfs_make_peropen (struct node *np, int flags, struct peropen *context)
 {
   struct peropen *po = malloc (sizeof (struct peropen));
+
+  if (! po)
+    return NULL;
 
   po->filepointer = 0;
   po->lock_status = LOCK_UN;
--- hurd-20010329-snapshot/libdiskfs/io-identity.c      Sat Oct 24 09:52:30 1998
+++ hurd-20010329/libdiskfs/io-identity.c       Sat Mar 31 09:51:20 2001
@@ -1,5 +1,5 @@
 /* libdiskfs implementation of io_identity RPC
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
    This file is part of the GNU Hurd.
@@ -60,7 +60,7 @@
     {
       *idtype = MACH_MSG_TYPE_MAKE_SEND;
       *fsystype = MACH_MSG_TYPE_MAKE_SEND;
-      *fileno = np->dn_stat.st_ino;
+      *fileno = inum;
     }
 
   return err;

Attachment: pgpjVUa_2TgAF.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]