glendix

view netfs/tcp.c @ 83:6fdffc287daf

Tutorial: How to process the written instructions in netfs
author Rahul Murmuria <rahul@murmuria.in>
date Sat Apr 04 21:17:51 2009 -0500 (2009-04-04)
parents 5fe1f801a6c6
children ef351368303b
line source
1 /*
2 * Copyright 2009 Rahul Murmuria <rahul@murmuria.in>
3 * This file may be redistributed under the terms of the GNU GPL.
4 */
6 #define __NO_VERSION__
8 #include "net.h"
9 /*
10 * Create the files that we export.
11 */
13 void tcp_create_files (struct super_block *sb, struct dentry *root)
14 {
15 static char *clone_tmp, *stats_tmp;
16 struct dentry *subdir;
18 subdir = slashnet_create_dir(sb, root, "tcp");
19 if (subdir) {
20 clone_tmp = kmalloc(TMPSIZE, GFP_KERNEL);
21 memset (clone_tmp, 0, TMPSIZE);
22 slashnet_create_file(sb, subdir, "clone", clone_tmp);
24 stats_tmp = kmalloc(TMPSIZE, GFP_KERNEL);
25 memset (stats_tmp, 0, TMPSIZE);
26 slashnet_create_file(sb, subdir, "stats", stats_tmp);
27 /*
28 * NOTE: stat_tmp and clone_tmp should not be free'd here because
29 * the same memory is being assigned to inode->-_private in the
30 * main program. It is desirable to have this memory allotted for
31 * every file as long as the filesystem is mount on a directory.
32 */
34 }
35 }
37 /*
38 * Processing the written instructions
39 */
41 /*
42 * /net/tcp/clone
43 */
45 void tcp_clone_process (struct file *filp)
46 {
47 char *tmp;
48 tmp = (char *)(filp->private_data);
49 strcat(tmp, ":processed");
50 }