commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 34/43: libdiskfs: Simplify type checks.


From: Samuel Thibault
Subject: [hurd] 34/43: libdiskfs: Simplify type checks.
Date: Mon, 11 Sep 2017 07:10:12 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 59dacf77dc0aa25dfda3b192ec099e7310d543d2
Author: Justus Winter <address@hidden>
Date:   Thu Aug 24 11:09:05 2017 +0200

    libdiskfs: Simplify type checks.
    
    * libdiskfs/diskfs.h (diskfs_begin_using_control_port): Check port class.
    * libdiskfs/fsys-getfile.c (diskfs_S_fsys_getfile): Drop check.
    * libdiskfs/fsys-getroot.c (diskfs_S_fsys_getroot): Likewise.
    * libdiskfs/fsys-goaway.c (diskfs_S_fsys_goaway): Likewise.
    * libdiskfs/fsys-options.c (diskfs_S_fsys_{s,g}et_options): Likewise.
    * libdiskfs/fsys-syncfs.c (diskfs_S_fsys_syncfs): Likewise.
---
 libdiskfs/diskfs.h       | 4 ++--
 libdiskfs/fsys-getfile.c | 3 +--
 libdiskfs/fsys-getroot.c | 3 +--
 libdiskfs/fsys-goaway.c  | 9 ++++-----
 libdiskfs/fsys-options.c | 6 ++----
 libdiskfs/fsys-syncfs.c  | 7 +++----
 6 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h
index 402b65e..0e14852 100644
--- a/libdiskfs/diskfs.h
+++ b/libdiskfs/diskfs.h
@@ -925,7 +925,7 @@ diskfs_begin_using_protid_payload (unsigned long payload)
 DISKFS_EXTERN_INLINE struct diskfs_control *
 diskfs_begin_using_control_port (fsys_t port)
 {
-  return ports_lookup_port (diskfs_port_bucket, port, NULL);
+  return ports_lookup_port (diskfs_port_bucket, port, diskfs_control_class);
 }
 
 DISKFS_EXTERN_INLINE struct diskfs_control *
@@ -933,7 +933,7 @@ diskfs_begin_using_control_port_payload (unsigned long 
payload)
 {
   return ports_lookup_payload (diskfs_port_bucket,
                               payload,
-                              NULL);
+                              diskfs_control_class);
 }
 
 /* And for the exec_startup interface. */
diff --git a/libdiskfs/fsys-getfile.c b/libdiskfs/fsys-getfile.c
index 9dd5d73..e4dbe36 100644
--- a/libdiskfs/fsys-getfile.c
+++ b/libdiskfs/fsys-getfile.c
@@ -42,8 +42,7 @@ diskfs_S_fsys_getfile (struct diskfs_control *pt,
   struct peropen *new_po;
   struct iouser *user;
 
-  if (!pt
-      || pt->pi.class != diskfs_control_class)
+  if (!pt)
     return EOPNOTSUPP;
 
   if (handle_len != sizeof *f)
diff --git a/libdiskfs/fsys-getroot.c b/libdiskfs/fsys-getroot.c
index 6f93888..735f359 100644
--- a/libdiskfs/fsys-getroot.c
+++ b/libdiskfs/fsys-getroot.c
@@ -54,8 +54,7 @@ diskfs_S_fsys_getroot (struct diskfs_control *pt,
     path: NULL,
   };
 
-  if (!pt
-      || pt->pi.class != diskfs_control_class)
+  if (!pt)
     return EOPNOTSUPP;
 
   flags &= O_HURD;
diff --git a/libdiskfs/fsys-goaway.c b/libdiskfs/fsys-goaway.c
index 9b64195..f716970 100644
--- a/libdiskfs/fsys-goaway.c
+++ b/libdiskfs/fsys-goaway.c
@@ -31,13 +31,12 @@ diskfs_S_fsys_goaway (struct diskfs_control *pt,
                      int flags)
 {
   error_t ret;
-  
-  if (!pt
-      || pt->pi.class != diskfs_control_class)
+
+  if (!pt)
     return EOPNOTSUPP;
-  
+
   /* XXX FSYS_GOAWAY_NOWAIT not implemented. */
-  
+
   ret = diskfs_shutdown (flags);
 
   if (ret == 0)
diff --git a/libdiskfs/fsys-options.c b/libdiskfs/fsys-options.c
index b366d14..f676ed0 100644
--- a/libdiskfs/fsys-options.c
+++ b/libdiskfs/fsys-options.c
@@ -58,8 +58,7 @@ diskfs_S_fsys_set_options (struct diskfs_control *pt,
        return error;
       }
 
-  if (!pt
-      || pt->pi.class != diskfs_control_class)
+  if (!pt)
     return EOPNOTSUPP;
 
   if (do_children)
@@ -90,8 +89,7 @@ diskfs_S_fsys_get_options (struct diskfs_control *port,
   size_t argz_len = 0;
   error_t err;
 
-  if (!port
-      || port->pi.class != diskfs_control_class)
+  if (!port)
     return EOPNOTSUPP;
 
   err = argz_add (&argz, &argz_len, program_invocation_name);
diff --git a/libdiskfs/fsys-syncfs.c b/libdiskfs/fsys-syncfs.c
index 4dceed7..17b83ee 100644
--- a/libdiskfs/fsys-syncfs.c
+++ b/libdiskfs/fsys-syncfs.c
@@ -46,11 +46,10 @@ diskfs_S_fsys_syncfs (struct diskfs_control *pi,
        pthread_mutex_lock (&np->lock);
        return 0;
       }
-  
-  if (!pi
-      || pi->pi.class != diskfs_control_class)
+
+  if (!pi)
     return EOPNOTSUPP;
-  
+
   pthread_rwlock_rdlock (&diskfs_fsys_lock);
 
   if (children)

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

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