forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
271-3.10.0.patch
809 lines (739 loc) · 22.9 KB
/
271-3.10.0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
--- a/vmnet-only/bridge.c
+++ b/vmnet-only/bridge.c
@@ -105,8 +105,6 @@ static Bool VNetBridgeCycleDetect(VNetJack *this, int generation);
static Bool VNetBridgeIsDeviceWireless(struct net_device *dev);
static void VNetBridgePortsChanged(VNetJack *this);
static int VNetBridgeIsBridged(VNetJack *this);
-static int VNetBridgeProcRead(char *page, char **start, off_t off,
- int count, int *eof, void *data);
static void VNetBridgeComputeHeaderPosIPv6(struct sk_buff *skb);
static PacketStatus VNetCallSMACFunc(struct SMACState *state,
struct sk_buff **skb, void *startOfData,
@@ -225,6 +223,53 @@ VNetBridgeDevCompatible(VNetBridge *bridge, // IN: Bridge
/*
*----------------------------------------------------------------------
*
+ * VNetBridgeProcShow --
+ *
+ * Callback for read operation on this bridge entry in vnets proc fs.
+ *
+ * Results:
+ * Length of read operation.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+VNetBridgeProcShow(struct seq_file *seqf, // IN/OUT: buffer to write into
+ void *data) // IN: client data - pointer to bridge
+{
+ VNetBridge *bridge = (VNetBridge*)data;
+
+ if (!bridge) {
+ return 0;
+ }
+
+ VNetPrintPort(&bridge->port, seqf);
+
+ seq_printf(seqf, "dev %s ", bridge->name);
+
+ seq_printf(seqf, "\n");
+
+ return 0;
+}
+
+static int proc_bridge_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, VNetBridgeProcShow, PDE_DATA(inode));
+}
+
+static const struct file_operations proc_bridge_fops = {
+ .open = proc_bridge_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
* VNetBridge_Create --
*
* Creates a bridge. Allocates struct, allocates internal device,
@@ -319,17 +364,14 @@ VNetBridge_Create(const char *devName, // IN: name of device (e.g., "eth0")
* Make proc entry for this jack.
*/
- retval = VNetProc_MakeEntry(bridge->port.jack.name, S_IFREG,
- &bridge->port.jack.procEntry);
+ retval = VNetProc_MakeEntryOps(bridge->port.jack.name, S_IFREG,
+ &bridge->port.jack.procEntry, &proc_bridge_fops, bridge);
if (retval) {
if (retval == -ENXIO) {
bridge->port.jack.procEntry = NULL;
} else {
goto out;
}
- } else {
- bridge->port.jack.procEntry->read_proc = VNetBridgeProcRead;
- bridge->port.jack.procEntry->data = bridge;
}
/*
@@ -1719,45 +1761,3 @@ VNetBridgeReceiveFromDev(struct sk_buff *skb, // IN: packet to receive
return 0;
}
-
-/*
- *----------------------------------------------------------------------
- *
- * VNetBridgeProcRead --
- *
- * Callback for read operation on this bridge entry in vnets proc fs.
- *
- * Results:
- * Length of read operation.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-VNetBridgeProcRead(char *page, // IN/OUT: buffer to write into
- char **start, // OUT: 0 if file < 4k, else offset into page
- off_t off, // IN: (unused) offset of read into the file
- int count, // IN: (unused) maximum number of bytes to read
- int *eof, // OUT: TRUE if there is nothing more to read
- void *data) // IN: client data - pointer to bridge
-{
- VNetBridge *bridge = (VNetBridge*)data;
- int len = 0;
-
- if (!bridge) {
- return len;
- }
-
- len += VNetPrintPort(&bridge->port, page+len);
-
- len += sprintf(page+len, "dev %s ", bridge->name);
-
- len += sprintf(page+len, "\n");
-
- *start = 0;
- *eof = 1;
- return len;
-}
--- a/vmnet-only/driver.c
+++ b/vmnet-only/driver.c
@@ -1785,21 +1785,17 @@ VNetSetMACUnique(VNetPort *port, // IN:
*----------------------------------------------------------------------
*/
-int
+void
VNetPrintJack(const VNetJack *jack, // IN: jack
- char *buf) // OUT: info about jack
+ struct seq_file *seqf) // OUT: info about jack
{
- int len = 0;
-
read_lock(&vnetPeerLock);
if (!jack->peer) {
- len += sprintf(buf+len, "connected not ");
+ seq_printf(seqf, "connected not ");
} else {
- len += sprintf(buf+len, "connected %s ", jack->peer->name);
+ seq_printf(seqf, "connected %s ", jack->peer->name);
}
read_unlock(&vnetPeerLock);
-
- return len;
}
@@ -1819,52 +1815,48 @@ VNetPrintJack(const VNetJack *jack, // IN: jack
*----------------------------------------------------------------------
*/
-int
+void
VNetPrintPort(const VNetPort *port, // IN: port
- char *buf) // OUT: info about port
+ struct seq_file *seqf) // OUT: info about port
{
- int len = 0;
+ VNetPrintJack(&port->jack, seqf);
- len += VNetPrintJack(&port->jack, buf+len);
-
- len += sprintf(buf+len, "mac %02x:%02x:%02x:%02x:%02x:%02x ",
+ seq_printf(seqf, "mac %02x:%02x:%02x:%02x:%02x:%02x ",
port->paddr[0], port->paddr[1], port->paddr[2],
port->paddr[3], port->paddr[4], port->paddr[5]);
- len += sprintf(buf+len, "ladrf %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",
+ seq_printf(seqf, "ladrf %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",
port->ladrf[0], port->ladrf[1], port->ladrf[2],
port->ladrf[3], port->ladrf[4], port->ladrf[5],
port->ladrf[6], port->ladrf[7]);
- len += sprintf(buf+len, "flags IFF_RUNNING");
+ seq_printf(seqf, "flags IFF_RUNNING");
if (port->flags & IFF_UP) {
- len += sprintf(buf+len, ",IFF_UP");
+ seq_printf(seqf, ",IFF_UP");
}
if (port->flags & IFF_BROADCAST) {
- len += sprintf(buf+len, ",IFF_BROADCAST");
+ seq_printf(seqf, ",IFF_BROADCAST");
}
if (port->flags & IFF_DEBUG) {
- len += sprintf(buf+len, ",IFF_DEBUG");
+ seq_printf(seqf, ",IFF_DEBUG");
}
if (port->flags & IFF_PROMISC) {
- len += sprintf(buf+len, ",IFF_PROMISC");
+ seq_printf(seqf, ",IFF_PROMISC");
}
if (port->flags & IFF_MULTICAST) {
- len += sprintf(buf+len, ",IFF_MULTICAST");
+ seq_printf(seqf, ",IFF_MULTICAST");
}
if (port->flags & IFF_ALLMULTI) {
- len += sprintf(buf+len, ",IFF_ALLMULTI");
+ seq_printf(seqf, ",IFF_ALLMULTI");
}
- len += sprintf(buf+len, " ");
-
- return len;
+ seq_printf(seqf, " ");
}
--- a/vmnet-only/hub.c
+++ b/vmnet-only/hub.c
@@ -25,6 +25,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/poll.h>
+#include <linux/seq_file.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
@@ -71,8 +72,6 @@ static void VNetHubReceive(VNetJack *this, struct sk_buff *skb);
static Bool VNetHubCycleDetect(VNetJack *this, int generation);
static void VNetHubPortsChanged(VNetJack *this);
static int VNetHubIsBridged(VNetJack *this);
-static int VNetHubProcRead(char *page, char **start, off_t off,
- int count, int *eof, void *data);
static VNetHub *vnetHub;
static DEFINE_SPINLOCK(vnetHubLock);
@@ -241,6 +240,53 @@ VNetHub_AllocPvn(uint8 id[]) // IN: the PVN ID to alloc on
/*
*----------------------------------------------------------------------
*
+ * VNetHubProcShow --
+ *
+ * Callback for read operation on hub entry in vnets proc fs.
+ *
+ * Results:
+ * Length of read operation.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+VNetHubProcShow(struct seq_file *seqf, // IN/OUT: buffer to write into
+ void *data) // IN: client data - not used
+{
+ VNetJack *jack = (VNetJack*)data;
+ VNetHub *hub;
+
+ if (!jack || !jack->private) {
+ return 0;
+ }
+ hub = (VNetHub*)jack->private;
+
+ VNetPrintJack(jack, seqf);
+
+ seq_printf(seqf, "tx %u ", hub->stats[jack->index].tx);
+ seq_printf(seqf, "\n");
+ return 0;
+}
+
+static int proc_hub_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, VNetHubProcShow, PDE_DATA(inode));
+}
+
+static const struct file_operations proc_hub_fops = {
+ .open = proc_hub_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
* VNetHubAlloc --
*
* Allocate a jack on this hub.
@@ -354,7 +400,7 @@ VNetHubAlloc(Bool allocPvn, // IN: TRUE for PVN, FALSE for vnet
* Make proc entry for this jack.
*/
- retval = VNetProc_MakeEntry(jack->name, S_IFREG, &jack->procEntry);
+ retval = VNetProc_MakeEntryOps(jack->name, S_IFREG, &jack->procEntry, &proc_hub_fops, jack);
if (retval) {
if (retval == -ENXIO) {
jack->procEntry = NULL;
@@ -362,9 +408,6 @@ VNetHubAlloc(Bool allocPvn, // IN: TRUE for PVN, FALSE for vnet
hub->used[i] = FALSE;
return NULL;
}
- } else {
- jack->procEntry->read_proc = VNetHubProcRead;
- jack->procEntry->data = jack;
}
/*
@@ -686,46 +729,3 @@ VNetHubIsBridged(VNetJack *this)
}
-/*
- *----------------------------------------------------------------------
- *
- * VNetHubProcRead --
- *
- * Callback for read operation on hub entry in vnets proc fs.
- *
- * Results:
- * Length of read operation.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-VNetHubProcRead(char *page, // IN/OUT: buffer to write into
- char **start, // OUT: 0 if file < 4k, else offset into page
- off_t off, // IN: offset of read into the file
- int count, // IN: maximum number of bytes to read
- int *eof, // OUT: TRUE if there is nothing more to read
- void *data) // IN: client data - not used
-{
- VNetJack *jack = (VNetJack*)data;
- VNetHub *hub;
- int len = 0;
-
- if (!jack || !jack->private) {
- return len;
- }
- hub = (VNetHub*)jack->private;
-
- len += VNetPrintJack(jack, page+len);
-
- len += sprintf(page+len, "tx %u ", hub->stats[jack->index].tx);
-
- len += sprintf(page+len, "\n");
-
- *start = 0;
- *eof = 1;
- return len;
-}
--- a/vmnet-only/netif.c
+++ b/vmnet-only/netif.c
@@ -62,8 +62,6 @@ static int VNetNetifStartXmit(struct sk_buff *skb, struct net_device *dev);
static struct net_device_stats *VNetNetifGetStats(struct net_device *dev);
static int VNetNetifSetMAC(struct net_device *dev, void *addr);
static void VNetNetifSetMulticast(struct net_device *dev);
-static int VNetNetIfProcRead(char *page, char **start, off_t off,
- int count, int *eof, void *data);
/*
*----------------------------------------------------------------------
@@ -116,6 +114,53 @@ VNetNetIfSetup(struct net_device *dev) // IN:
}
+/*
+ *----------------------------------------------------------------------
+ *
+ * VNetNetIfProcShow --
+ *
+ * Callback for read operation on this netif entry in vnets proc fs.
+ *
+ * Results:
+ * Length of read operation.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+VNetNetIfProcShow(struct seq_file *seqf, // IN/OUT: buffer to write into
+ void *data) // IN: client data
+{
+ VNetNetIF *netIf = data;
+
+ if (!netIf) {
+ return 0;
+ }
+
+ VNetPrintPort(&netIf->port, seqf);
+
+ seq_printf(seqf, "dev %s ", netIf->dev->name);
+
+ seq_printf(seqf, "\n");
+
+ return 0;
+}
+
+static int proc_netif_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, VNetNetIfProcShow, PDE_DATA(inode));
+}
+
+static const struct file_operations proc_netif_fops = {
+ .open = proc_netif_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
/*
*----------------------------------------------------------------------
@@ -180,16 +225,13 @@ VNetNetIf_Create(char *devName, // IN:
* Make proc entry for this jack.
*/
- retval = VNetProc_MakeEntry(netIf->port.jack.name, S_IFREG,
- &netIf->port.jack.procEntry);
+ retval = VNetProc_MakeEntryOps(netIf->port.jack.name, S_IFREG,
+ &netIf->port.jack.procEntry, &proc_netif_fops, netIf);
if (retval) {
netIf->port.jack.procEntry = NULL;
if (retval != -ENXIO) {
goto outFreeDev;
}
- } else {
- netIf->port.jack.procEntry->read_proc = VNetNetIfProcRead;
- netIf->port.jack.procEntry->data = netIf;
}
/*
@@ -553,45 +595,3 @@ VNetNetifGetStats(struct net_device *dev) // IN:
return &netIf->stats;
}
-
-/*
- *----------------------------------------------------------------------
- *
- * VNetNetIfProcRead --
- *
- * Callback for read operation on this netif entry in vnets proc fs.
- *
- * Results:
- * Length of read operation.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-VNetNetIfProcRead(char *page, // IN/OUT: buffer to write into
- char **start, // OUT: 0 if file < 4k, else offset into page
- off_t off, // IN: (unused) offset of read into the file
- int count, // IN: (unused) maximum number of bytes to read
- int *eof, // OUT: TRUE if there is nothing more to read
- void *data) // IN: client data
-{
- VNetNetIF *netIf = data;
- int len = 0;
-
- if (!netIf) {
- return len;
- }
-
- len += VNetPrintPort(&netIf->port, page+len);
-
- len += sprintf(page+len, "dev %s ", netIf->dev->name);
-
- len += sprintf(page+len, "\n");
-
- *start = 0;
- *eof = 1;
- return len;
-}
--- a/vmnet-only/procfs.c
+++ b/vmnet-only/procfs.c
@@ -45,10 +45,6 @@
#if defined(CONFIG_PROC_FS)
-static int VNetProcMakeEntryInt(VNetProcEntry *parent, char *name, int mode,
- VNetProcEntry **ret);
-static void VNetProcRemoveEntryInt(VNetProcEntry *node, VNetProcEntry *parent);
-
static VNetProcEntry *base = NULL;
@@ -71,7 +67,12 @@ static VNetProcEntry *base = NULL;
int
VNetProc_Init(void)
{
- return VNetProcMakeEntryInt(NULL, "vmnet", S_IFDIR, &base);
+ base = proc_mkdir("vmnet", NULL);
+ if(IS_ERR(base)) {
+ base = NULL;
+ return PTR_ERR(base);
+ }
+ return 0;
}
@@ -94,14 +95,14 @@ VNetProc_Init(void)
void
VNetProc_Cleanup(void)
{
- VNetProcRemoveEntryInt(base, NULL);
+ proc_remove(base);
base = NULL;
}
/*
*----------------------------------------------------------------------
*
- * VNetProcMakeEntryInt --
+ * VNetProc_MakeEntryOps --
*
* Make an entry in the vnets proc file system.
*
@@ -116,72 +117,21 @@ VNetProc_Cleanup(void)
*/
int
-VNetProcMakeEntryInt(VNetProcEntry *parent, // IN:
- char *name, // IN:
+VNetProc_MakeEntryOps(char *name, // IN:
int mode, // IN:
- VNetProcEntry **ret) // OUT:
+ VNetProcEntry **ret,
+ const struct file_operations *fops,
+ void *data
+ ) // OUT:
{
VNetProcEntry *ent;
- ent = create_proc_entry(name, mode, parent);
+ ent = proc_create_data(name, mode, base, fops, data);
*ret = ent;
if (!ent)
return -ENOMEM;
return 0;
}
-
-/*
- *----------------------------------------------------------------------
- *
- * VNetProcRemoveEntryInt --
- *
- * Remove a previously installed proc entry.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-VNetProcRemoveEntryInt(VNetProcEntry *node,
- VNetProcEntry *parent)
-{
- if (node) {
- remove_proc_entry(node->name, parent);
- }
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
- * VNetProc_MakeEntry --
- *
- * Make an entry in the vnets proc file system.
- *
- * Results:
- * errno. If errno is 0 and ret is non NULL then ret is filled
- * in with the resulting proc entry.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-VNetProc_MakeEntry(char *name, // IN:
- int mode, // IN:
- VNetProcEntry **ret) // OUT:
-{
- return VNetProcMakeEntryInt(base, name, mode, ret);
-}
-
-
/*
*----------------------------------------------------------------------
*
@@ -201,7 +151,8 @@ VNetProc_MakeEntry(char *name, // IN:
void
VNetProc_RemoveEntry(VNetProcEntry *node)
{
- VNetProcRemoveEntryInt(node, base);
+ if(node)
+ proc_remove(node);
}
@@ -253,31 +204,6 @@ VNetProc_Cleanup(void)
}
-/*
- *----------------------------------------------------------------------
- *
- * VNetProc_MakeEntry --
- *
- * Make an entry in the vnets proc file system.
- *
- * Results:
- * errno. If errno is 0 and ret is non NULL then ret is filled
- * in with the resulting proc entry.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-VNetProc_MakeEntry(char *name,
- int mode,
- VNetProcEntry **ret)
-{
- return -ENXIO;
-}
-
/*
*----------------------------------------------------------------------
--- a/vmnet-only/userif.c
+++ b/vmnet-only/userif.c
@@ -389,7 +389,7 @@ VNetUserIfReceive(VNetJack *this, // IN
/*
*----------------------------------------------------------------------
*
- * VNetUserIfProcRead --
+ * VNetUserIfProcShow --
*
* Callback for read operation on this userif entry in vnets proc fs.
*
@@ -403,30 +403,23 @@ VNetUserIfReceive(VNetJack *this, // IN
*/
static int
-VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into
- char **start, // OUT: 0 if file < 4k, else offset into
- // page
- off_t off, // IN: offset of read into the file
- int count, // IN: maximum number of bytes to read
- int *eof, // OUT: TRUE if there is nothing more to
- // read
+VNetUserIfProcShow(struct seq_file *seqf, // IN/OUT: buffer to write into
void *data) // IN: client data - not used
{
VNetUserIF *userIf = (VNetUserIF*)data;
- int len = 0;
if (!userIf) {
- return len;
+ return 0;
}
- len += VNetPrintPort(&userIf->port, page+len);
+ VNetPrintPort(&userIf->port, seqf);
- len += sprintf(page+len, "read %u written %u queued %u ",
+ seq_printf(seqf, "read %u written %u queued %u ",
userIf->stats.read,
userIf->stats.written,
userIf->stats.queued);
- len += sprintf(page+len,
+ seq_printf(seqf,
"dropped.down %u dropped.mismatch %u "
"dropped.overflow %u dropped.largePacket %u",
userIf->stats.droppedDown,
@@ -434,13 +427,23 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into
userIf->stats.droppedOverflow,
userIf->stats.droppedLargePacket);
- len += sprintf(page+len, "\n");
+ seq_printf(seqf, "\n");
- *start = 0;
- *eof = 1;
- return len;
+ return 0;
+}
+
+static int proc_userif_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, VNetUserIfProcShow, PDE_DATA(inode));
}
+static const struct file_operations proc_userif_fops = {
+ .open = proc_userif_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
/*
*----------------------------------------------------------------------
@@ -1036,8 +1039,8 @@ VNetUserIf_Create(VNetPort **ret) // OUT
* Make proc entry for this jack.
*/
- retval = VNetProc_MakeEntry(userIf->port.jack.name, S_IFREG,
- &userIf->port.jack.procEntry);
+ retval = VNetProc_MakeEntryOps(userIf->port.jack.name, S_IFREG,
+ &userIf->port.jack.procEntry, &proc_userif_fops, userIf);
if (retval) {
if (retval == -ENXIO) {
userIf->port.jack.procEntry = NULL;
@@ -1045,9 +1048,6 @@ VNetUserIf_Create(VNetPort **ret) // OUT
kfree(userIf);
return retval;
}
- } else {
- userIf->port.jack.procEntry->read_proc = VNetUserIfProcRead;
- userIf->port.jack.procEntry->data = userIf;
}
/*
--- a/vmnet-only/vnetInt.h
+++ b/vmnet-only/vnetInt.h
@@ -171,12 +171,14 @@ VNetJack *VNetDisconnect(VNetJack *jack);
void VNetSend(const VNetJack *jack, struct sk_buff *skb);
-int VNetProc_MakeEntry(char *name, int mode,
- VNetProcEntry **ret);
+int VNetProc_MakeEntryOps(char *name, int mode,
+ VNetProcEntry **ret,
+ const struct file_operations *fops,
+ void *data);
void VNetProc_RemoveEntry(VNetProcEntry *node);
-int VNetPrintJack(const VNetJack *jack, char *buf);
+void VNetPrintJack(const VNetJack *jack, struct seq_file *seqf);
int VNet_MakeMACAddress(VNetPort *port);
@@ -196,7 +198,7 @@ Bool VNetPacketMatch(const uint8 *destAddr, const uint8 *ifAddr,
Bool VNetCycleDetectIf(const char *name, int generation);
-int VNetPrintPort(const VNetPort *port, char *buf);
+void VNetPrintPort(const VNetPort *port, struct seq_file *seqf);
int VNetSnprintf(char *str, size_t size, const char *format, ...);
--
--- a/vmblock-only/linux/control.c 2013-05-21 19:21:19.165750556 +0200
+++ b/vmblock-only/linux/control.c 2013-05-21 19:22:18.363747723 +0200
@@ -208,9 +208,10 @@
VMBlockSetProcEntryOwner(controlProcMountpoint);
/* Create /proc/fs/vmblock/dev */
- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
- VMBLOCK_CONTROL_MODE,
- controlProcDirEntry);
+ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME,
+ VMBLOCK_CONTROL_MODE,
+ controlProcDirEntry,
+ &ControlFileOps);
if (!controlProcEntry) {
Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
@@ -218,7 +219,6 @@
return -EINVAL;
}
- controlProcEntry->proc_fops = &ControlFileOps;
return 0;
}