From: rpeterso@sourceware.org <rpeterso@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gfs-kernel/src/gfs Makefile main.c mou ...
Date: 18 Jul 2006 20:48:23 -0000 [thread overview]
Message-ID: <20060718204823.9558.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2006-07-18 20:48:20
Modified files:
gfs-kernel/src/gfs: Makefile main.c mount.c ops_fstype.c
ops_super.c sys.c
Added files:
gfs-kernel/src/gfs: proc.c proc.h
Log message:
Add /proc/fs/gfs support back in.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/proc.c.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/proc.h.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/Makefile.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/main.c.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/mount.c.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_fstype.c.diff?cvsroot=cluster&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_super.c.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/sys.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
--- cluster/gfs-kernel/src/gfs/proc.c 2006/07/10 23:22:34 1.8
+++ cluster/gfs-kernel/src/gfs/proc.c 2006/07/18 20:48:20 1.9
@@ -43,11 +43,9 @@
void
gfs_proc_fs_add(struct gfs_sbd *sdp)
{
- ENTER(GFN_PROC_FS_ADD)
down(&gfs_fs_lock);
list_add(&sdp->sd_list, &gfs_fs_list);
up(&gfs_fs_lock);
- RET(GFN_PROC_FS_ADD);
}
/**
@@ -59,11 +57,9 @@
void
gfs_proc_fs_del(struct gfs_sbd *sdp)
{
- ENTER(GFN_PROC_FS_DEL)
down(&gfs_fs_lock);
list_del(&sdp->sd_list);
up(&gfs_fs_lock);
- RET(GFN_PROC_FS_DEL);
}
/**
@@ -77,7 +73,6 @@
static ssize_t
do_list(char *user_buf, size_t size)
{
- ENTER(GFN_DO_LIST)
struct list_head *tmp;
struct gfs_sbd *sdp = NULL;
unsigned int x;
@@ -124,7 +119,7 @@
out:
up(&gfs_fs_lock);
- RETURN(GFN_DO_LIST, error);
+ return error;
}
/**
@@ -137,19 +132,18 @@
static char *
find_argument(char *p)
{
- ENTER(GFN_FIND_ARGUMENT)
char *p2;
while (*p == ' ' || *p == '\n')
p++;
if (!*p)
- RETURN(GFN_FIND_ARGUMENT, NULL);
+ return NULL;
for (p2 = p; *p2; p2++) /* do nothing */;
p2--;
while (*p2 == ' ' || *p2 == '\n')
*p2-- = 0;
- RETURN(GFN_FIND_ARGUMENT, p);
+ return p;
}
/**
@@ -162,7 +156,6 @@
static int
do_freeze(char *p)
{
- ENTER(GFN_DO_FREEZE)
struct list_head *tmp;
struct gfs_sbd *sdp;
char num[21];
@@ -170,7 +163,7 @@
p = find_argument(p + 6);
if (!p)
- RETURN(GFN_DO_FREEZE, -ENOENT);
+ return -ENOENT;
down(&gfs_fs_lock);
@@ -188,7 +181,7 @@
up(&gfs_fs_lock);
- RETURN(GFN_DO_FREEZE, error);
+ return error;
}
/**
@@ -201,7 +194,6 @@
static int
do_unfreeze(char *p)
{
- ENTER(GFN_DO_UNFREEZE)
struct list_head *tmp;
struct gfs_sbd *sdp;
char num[21];
@@ -209,7 +201,7 @@
p = find_argument(p + 8);
if (!p)
- RETURN(GFN_DO_UNFREEZE, -ENOENT);
+ return -ENOENT;
down(&gfs_fs_lock);
@@ -227,7 +219,7 @@
up(&gfs_fs_lock);
- RETURN(GFN_DO_UNFREEZE, error);
+ return error;
}
/**
@@ -240,16 +232,15 @@
static int
do_margs(char *p)
{
- ENTER(GFN_DO_MARGS)
char *new_buf, *old_buf;
p = find_argument(p + 5);
if (!p)
- RETURN(GFN_DO_MARGS, -ENOENT);
+ return -ENOENT;
new_buf = kmalloc(strlen(p) + 1, GFP_KERNEL);
if (!new_buf)
- RETURN(GFN_DO_MARGS, -ENOMEM);
+ return -ENOMEM;
strcpy(new_buf, p);
spin_lock(&gfs_proc_margs_lock);
@@ -260,7 +251,7 @@
if (old_buf)
kfree(old_buf);
- RETURN(GFN_DO_MARGS, 0);
+ return 0;
}
/**
@@ -273,7 +264,6 @@
static int
do_withdraw(char *p)
{
- ENTER(GFN_DO_WITHDRAW)
struct list_head *tmp;
struct gfs_sbd *sdp;
char num[21];
@@ -281,7 +271,7 @@
p = find_argument(p + 8);
if (!p)
- RETURN(GFN_DO_WITHDRAW, -ENOENT);
+ return -ENOENT;
down(&gfs_fs_lock);
@@ -301,7 +291,7 @@
up(&gfs_fs_lock);
- RETURN(GFN_DO_WITHDRAW, error);
+ return error;
}
/**
@@ -316,7 +306,6 @@
static int
do_lockdump(char *p, char *buf, size_t size)
{
- ENTER(GFN_DO_LOCKDUMP)
struct list_head *tmp;
struct gfs_sbd *sdp;
char num[21];
@@ -325,7 +314,7 @@
p = find_argument(p + 8);
if (!p)
- RETURN(GFN_DO_LOCKDUMP, -ENOENT);
+ return -ENOENT;
down(&gfs_fs_lock);
@@ -350,7 +339,7 @@
up(&gfs_fs_lock);
- RETURN(GFN_DO_LOCKDUMP, error);
+ return error;
}
/**
@@ -366,7 +355,6 @@
static ssize_t
gfs_proc_write(struct file *file, const char *buf, size_t size, loff_t *offset)
{
- ENTER(GFN_PROC_WRITE)
char *p;
spin_lock(&req_lock);
@@ -378,23 +366,23 @@
kfree(p);
if (!size)
- RETURN(GFN_PROC_WRITE, -EINVAL);
+ return -EINVAL;
p = kmalloc(size + 1, GFP_KERNEL);
if (!p)
- RETURN(GFN_PROC_WRITE, -ENOMEM);
+ return -ENOMEM;
p[size] = 0;
if (copy_from_user(p, buf, size)) {
kfree(p);
- RETURN(GFN_PROC_WRITE, -EFAULT);
+ return -EFAULT;
}
spin_lock(&req_lock);
file->private_data = p;
spin_unlock(&req_lock);
- RETURN(GFN_PROC_WRITE, size);
+ return size;
}
/**
@@ -410,7 +398,6 @@
static ssize_t
gfs_proc_read(struct file *file, char *buf, size_t size, loff_t *offset)
{
- ENTER(GFN_PROC_READ)
char *p;
int error;
@@ -420,11 +407,11 @@
spin_unlock(&req_lock);
if (!p)
- RETURN(GFN_PROC_READ, -ENOENT);
+ return -ENOENT;
if (!size) {
kfree(p);
- RETURN(GFN_PROC_READ, -EINVAL);
+ return -EINVAL;
}
if (strncmp(p, "list", 4) == 0)
@@ -444,7 +431,7 @@
kfree(p);
- RETURN(GFN_PROC_READ, error);
+ return error;
}
/**
@@ -458,10 +445,9 @@
static int
gfs_proc_close(struct inode *inode, struct file *file)
{
- ENTER(GFN_PROC_CLOSE)
if (file->private_data)
kfree(file->private_data);
- RETURN(GFN_PROC_CLOSE, 0);
+ return 0;
}
static struct file_operations gfs_proc_fops =
@@ -480,7 +466,6 @@
int
gfs_proc_init(void)
{
- ENTER(GFN_PROC_INIT)
struct proc_dir_entry *pde;
INIT_LIST_HEAD(&gfs_fs_list);
@@ -491,12 +476,12 @@
pde = create_proc_entry("fs/gfs", S_IFREG | 0600, NULL);
if (!pde)
- RETURN(GFN_PROC_INIT, -ENOMEM);
+ return -ENOMEM;
pde->owner = THIS_MODULE;
pde->proc_fops = &gfs_proc_fops;
- RETURN(GFN_PROC_INIT, 0);
+ return 0;
}
/**
@@ -507,10 +492,8 @@
void
gfs_proc_uninit(void)
{
- ENTER(GFN_PROC_UNINIT)
if (gfs_proc_margs)
kfree(gfs_proc_margs);
remove_proc_entry("fs/gfs", NULL);
- RET(GFN_PROC_UNINIT);
}
diff -u -r1.3 -r1.4
--- cluster/gfs-kernel/src/gfs/Makefile 2006/07/11 17:29:24 1.12
+++ cluster/gfs-kernel/src/gfs/Makefile 2006/07/18 20:48:20 1.13
@@ -55,6 +55,7 @@
ops_super.o \
ops_vm.o \
page.o \
+ proc.o \
quota.o \
recovery.o \
rgrp.o \
--- cluster/gfs-kernel/src/gfs/main.c 2006/07/10 23:22:34 1.8
+++ cluster/gfs-kernel/src/gfs/main.c 2006/07/18 20:48:20 1.9
@@ -25,6 +25,7 @@
#include "gfs.h"
#include "ops_fstype.h"
#include "sys.h"
+#include "proc.h"
/**
* init_gfs_fs - Register GFS as a filesystem
@@ -41,6 +42,9 @@
error = gfs_sys_init();
if (error)
return error;
+ error = gfs_proc_init();
+ if (error)
+ goto fail;
gfs_random_number = xtime.tv_nsec;
@@ -94,6 +98,8 @@
if (gfs_glock_cachep)
kmem_cache_destroy(gfs_glock_cachep);
+ gfs_proc_uninit();
+
fail:
gfs_sys_uninit();
@@ -115,6 +121,7 @@
kmem_cache_destroy(gfs_inode_cachep);
kmem_cache_destroy(gfs_glock_cachep);
+ gfs_proc_uninit();
gfs_sys_uninit();
}
--- cluster/gfs-kernel/src/gfs/mount.c 2006/07/11 17:29:24 1.13
+++ cluster/gfs-kernel/src/gfs/mount.c 2006/07/18 20:48:20 1.14
@@ -21,6 +21,7 @@
#include "gfs.h"
#include "mount.h"
+#include "proc.h"
#include "sys.h"
/**
@@ -40,6 +41,15 @@
/* If someone preloaded options, use those instead */
+ spin_lock(&gfs_proc_margs_lock);
+ if (gfs_proc_margs) {
+ data = gfs_proc_margs;
+ gfs_proc_margs = NULL;
+ }
+ spin_unlock(&gfs_proc_margs_lock);
+
+ /* Set some defaults */
+
memset(args, 0, sizeof(struct gfs_args));
args->ar_num_glockd = GFS_GLOCKD_DEFAULT;
--- cluster/gfs-kernel/src/gfs/ops_fstype.c 2006/07/10 23:22:34 1.25
+++ cluster/gfs-kernel/src/gfs/ops_fstype.c 2006/07/18 20:48:20 1.26
@@ -28,11 +28,12 @@
#include "ops_export.h"
#include "ops_fstype.h"
#include "ops_super.h"
-#include "sys.h"
+#include "proc.h"
#include "quota.h"
#include "recovery.h"
#include "rgrp.h"
#include "super.h"
+#include "sys.h"
#include "unlinked.h"
#define DO 0
@@ -669,6 +670,7 @@
if (error)
goto fail_journal;
+ gfs_proc_fs_add(sdp);
gfs_glock_dq_uninit(&mount_gh);
return 0;
--- cluster/gfs-kernel/src/gfs/ops_super.c 2006/07/10 23:22:34 1.21
+++ cluster/gfs-kernel/src/gfs/ops_super.c 2006/07/18 20:48:20 1.22
@@ -32,11 +32,12 @@
#include "ops_fstype.h"
#include "ops_super.h"
#include "page.h"
-#include "sys.h"
+#include "proc.h"
#include "quota.h"
#include "recovery.h"
#include "rgrp.h"
#include "super.h"
+#include "sys.h"
#include "mount.h"
/**
@@ -101,6 +102,8 @@
atomic_inc(&sdp->sd_ops_super);
+ gfs_proc_fs_del(sdp);
+
/* Unfreeze the filesystem, if we need to */
down(&sdp->sd_freeze_lock);
--- cluster/gfs-kernel/src/gfs/sys.c 2006/07/11 17:29:24 1.2
+++ cluster/gfs-kernel/src/gfs/sys.c 2006/07/18 20:48:20 1.3
@@ -28,11 +28,8 @@
#include "sys.h"
#include "super.h"
-struct list_head gfs_fs_list;
-struct semaphore gfs_fs_lock;
char *gfs_sys_margs;
spinlock_t gfs_sys_margs_lock;
-spinlock_t req_lock;
static ssize_t id_show(struct gfs_sbd *sdp, char *buf)
{
reply other threads:[~2006-07-18 20:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060718204823.9558.qmail@sourceware.org \
--to=rpeterso@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.