Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 484844
Collapse All | Expand All

(-)old/vmblock-only/linux/control.c (-4 / +4 lines)
Lines 208-216 Link Here
208
   VMBlockSetProcEntryOwner(controlProcMountpoint);
208
   VMBlockSetProcEntryOwner(controlProcMountpoint);
209
209
210
   /* Create /proc/fs/vmblock/dev */
210
   /* Create /proc/fs/vmblock/dev */
211
   controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
211
   controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME,
212
                                        VMBLOCK_CONTROL_MODE,
212
                                  VMBLOCK_CONTROL_MODE,
213
                                        controlProcDirEntry);
213
                                  controlProcDirEntry,
214
                                  &ControlFileOps);
214
   if (!controlProcEntry) {
215
   if (!controlProcEntry) {
215
      Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
216
      Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
216
      remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
217
      remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
Lines 218-224 Link Here
218
      return -EINVAL;
219
      return -EINVAL;
219
   }
220
   }
220
221
221
   controlProcEntry->proc_fops = &ControlFileOps;
222
   return 0;
222
   return 0;
223
}
223
}
224
224
(-)old/vmnet-only/bridge.c (-49 / +48 lines)
Lines 112-119 Link Here
112
static Bool VNetBridgeIsDeviceWireless(struct net_device *dev);
112
static Bool VNetBridgeIsDeviceWireless(struct net_device *dev);
113
static void VNetBridgePortsChanged(VNetJack *this);
113
static void VNetBridgePortsChanged(VNetJack *this);
114
static int  VNetBridgeIsBridged(VNetJack *this);
114
static int  VNetBridgeIsBridged(VNetJack *this);
115
static int  VNetBridgeProcRead(char *page, char **start, off_t off,
116
                               int count, int *eof, void *data);
117
static void VNetBridgeComputeHeaderPosIPv6(struct sk_buff *skb);
115
static void VNetBridgeComputeHeaderPosIPv6(struct sk_buff *skb);
118
static PacketStatus VNetCallSMACFunc(struct SMACState *state,
116
static PacketStatus VNetCallSMACFunc(struct SMACState *state,
119
                                     struct sk_buff **skb, void *startOfData,
117
                                     struct sk_buff **skb, void *startOfData,
Lines 270-275 Link Here
270
   return strcmp(net->name, bridge->name) == 0;
268
   return strcmp(net->name, bridge->name) == 0;
271
}
269
}
272
270
271
/*
272
 *----------------------------------------------------------------------
273
 *
274
 * VNetBridgeProcShow --
275
 *
276
 *      Callback for read operation on this bridge entry in vnets proc fs.
277
 *
278
 * Results:
279
 *      Length of read operation.
280
 *
281
 * Side effects:
282
 *      None.
283
 *
284
 *----------------------------------------------------------------------
285
 */
286
287
int
288
VNetBridgeProcShow(struct seq_file *seqf, // IN/OUT: buffer to write into
289
                   void    *data)   // IN: client data - pointer to bridge
290
{
291
   VNetBridge *bridge = (VNetBridge*)data;
292
293
   if (!bridge) {
294
      return 0;
295
   }
296
297
   VNetPrintPort(&bridge->port, seqf);
298
299
   seq_printf(seqf, "dev %s ", bridge->name);
300
301
   seq_printf(seqf, "\n");
302
303
   return 0;
304
}
305
306
static int proc_bridge_open(struct inode *inode, struct file *file)
307
{
308
       return single_open(file, VNetBridgeProcShow, PDE_DATA(inode));
309
}
310
311
static const struct file_operations proc_bridge_fops = {
312
       .open           = proc_bridge_open,
313
       .read           = seq_read,
314
       .llseek         = seq_lseek,
315
       .release        = seq_release,
316
};
273
317
274
/*
318
/*
275
 *----------------------------------------------------------------------
319
 *----------------------------------------------------------------------
Lines 368-384 Link Here
368
    * Make proc entry for this jack.
412
    * Make proc entry for this jack.
369
    */
413
    */
370
414
371
   retval = VNetProc_MakeEntry(bridge->port.jack.name, S_IFREG,
415
   retval = VNetProc_MakeEntryOps(bridge->port.jack.name, S_IFREG,
372
                               &bridge->port.jack.procEntry);
416
                               &bridge->port.jack.procEntry, &proc_bridge_fops, bridge);
373
   if (retval) {
417
   if (retval) {
374
      if (retval == -ENXIO) {
418
      if (retval == -ENXIO) {
375
         bridge->port.jack.procEntry = NULL;
419
         bridge->port.jack.procEntry = NULL;
376
      } else {
420
      } else {
377
         goto out;
421
         goto out;
378
      }
422
      }
379
   } else {
380
      bridge->port.jack.procEntry->read_proc = VNetBridgeProcRead;
381
      bridge->port.jack.procEntry->data = bridge;
382
   }
423
   }
383
424
384
   /*
425
   /*
Lines 1793-1837 Link Here
1793
   return 0;
1834
   return 0;
1794
}
1835
}
1795
1836
1796
1797
/*
1798
 *----------------------------------------------------------------------
1799
 *
1800
 * VNetBridgeProcRead --
1801
 *
1802
 *      Callback for read operation on this bridge entry in vnets proc fs.
1803
 *
1804
 * Results:
1805
 *      Length of read operation.
1806
 *
1807
 * Side effects:
1808
 *      None.
1809
 *
1810
 *----------------------------------------------------------------------
1811
 */
1812
1813
int
1814
VNetBridgeProcRead(char    *page,   // IN/OUT: buffer to write into
1815
                   char   **start,  // OUT: 0 if file < 4k, else offset into page
1816
                   off_t    off,    // IN: (unused) offset of read into the file
1817
                   int      count,  // IN: (unused) maximum number of bytes to read
1818
                   int     *eof,    // OUT: TRUE if there is nothing more to read
1819
                   void    *data)   // IN: client data - pointer to bridge
1820
{
1821
   VNetBridge *bridge = (VNetBridge*)data;
1822
   int len = 0;
1823
1824
   if (!bridge) {
1825
      return len;
1826
   }
1827
1828
   len += VNetPrintPort(&bridge->port, page+len);
1829
1830
   len += sprintf(page+len, "dev %s ", bridge->name);
1831
1832
   len += sprintf(page+len, "\n");
1833
1834
   *start = 0;
1835
   *eof   = 1;
1836
   return len;
1837
}
(-)old/vmnet-only/driver.c (-25 / +17 lines)
Lines 1662-1682 Link Here
1662
 *----------------------------------------------------------------------
1662
 *----------------------------------------------------------------------
1663
 */
1663
 */
1664
1664
1665
int
1665
void
1666
VNetPrintJack(const VNetJack *jack, // IN: jack
1666
VNetPrintJack(const VNetJack *jack, // IN: jack
1667
              char           *buf)  // OUT: info about jack
1667
              struct seq_file *seqf)  // OUT: info about jack
1668
{
1668
{
1669
   int len = 0;
1670
1671
   read_lock(&vnetPeerLock);
1669
   read_lock(&vnetPeerLock);
1672
   if (!jack->peer) {
1670
   if (!jack->peer) {
1673
      len += sprintf(buf+len, "connected not ");
1671
      seq_printf(seqf, "connected not ");
1674
   } else {
1672
   } else {
1675
      len += sprintf(buf+len, "connected %s ", jack->peer->name);
1673
      seq_printf(seqf, "connected %s ", jack->peer->name);
1676
   }
1674
   }
1677
   read_unlock(&vnetPeerLock);
1675
   read_unlock(&vnetPeerLock);
1678
1679
   return len;
1680
}
1676
}
1681
1677
1682
1678
Lines 1696-1747 Link Here
1696
 *----------------------------------------------------------------------
1692
 *----------------------------------------------------------------------
1697
 */
1693
 */
1698
1694
1699
int
1695
void
1700
VNetPrintPort(const VNetPort *port, // IN: port
1696
VNetPrintPort(const VNetPort *port, // IN: port
1701
              char           *buf)  // OUT: info about port
1697
              struct seq_file *seqf)  // OUT: info about port
1702
{
1698
{
1703
   int len = 0;
1699
   VNetPrintJack(&port->jack, seqf);
1704
1700
1705
   len += VNetPrintJack(&port->jack, buf+len);
1701
   seq_printf(seqf, "mac %02x:%02x:%02x:%02x:%02x:%02x ",
1706
1707
   len += sprintf(buf+len, "mac %02x:%02x:%02x:%02x:%02x:%02x ",
1708
                  port->paddr[0], port->paddr[1], port->paddr[2],
1702
                  port->paddr[0], port->paddr[1], port->paddr[2],
1709
                  port->paddr[3], port->paddr[4], port->paddr[5]);
1703
                  port->paddr[3], port->paddr[4], port->paddr[5]);
1710
1704
1711
   len += sprintf(buf+len, "ladrf %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",
1705
   seq_printf(seqf, "ladrf %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",
1712
                  port->ladrf[0], port->ladrf[1], port->ladrf[2],
1706
                  port->ladrf[0], port->ladrf[1], port->ladrf[2],
1713
                  port->ladrf[3], port->ladrf[4], port->ladrf[5],
1707
                  port->ladrf[3], port->ladrf[4], port->ladrf[5],
1714
                  port->ladrf[6], port->ladrf[7]);
1708
                  port->ladrf[6], port->ladrf[7]);
1715
1709
1716
   len += sprintf(buf+len, "flags IFF_RUNNING");
1710
   seq_printf(seqf, "flags IFF_RUNNING");
1717
1711
1718
   if (port->flags & IFF_UP) {
1712
   if (port->flags & IFF_UP) {
1719
      len += sprintf(buf+len, ",IFF_UP");
1713
      seq_printf(seqf, ",IFF_UP");
1720
   }
1714
   }
1721
1715
1722
   if (port->flags & IFF_BROADCAST) {
1716
   if (port->flags & IFF_BROADCAST) {
1723
      len += sprintf(buf+len, ",IFF_BROADCAST");
1717
      seq_printf(seqf, ",IFF_BROADCAST");
1724
   }
1718
   }
1725
1719
1726
   if (port->flags & IFF_DEBUG) {
1720
   if (port->flags & IFF_DEBUG) {
1727
      len += sprintf(buf+len, ",IFF_DEBUG");
1721
      seq_printf(seqf, ",IFF_DEBUG");
1728
   }
1722
   }
1729
1723
1730
   if (port->flags & IFF_PROMISC) {
1724
   if (port->flags & IFF_PROMISC) {
1731
      len += sprintf(buf+len, ",IFF_PROMISC");
1725
      seq_printf(seqf, ",IFF_PROMISC");
1732
   }
1726
   }
1733
1727
1734
   if (port->flags & IFF_MULTICAST) {
1728
   if (port->flags & IFF_MULTICAST) {
1735
      len += sprintf(buf+len, ",IFF_MULTICAST");
1729
      seq_printf(seqf, ",IFF_MULTICAST");
1736
   }
1730
   }
1737
1731
1738
   if (port->flags & IFF_ALLMULTI) {
1732
   if (port->flags & IFF_ALLMULTI) {
1739
      len += sprintf(buf+len, ",IFF_ALLMULTI");
1733
      seq_printf(seqf, ",IFF_ALLMULTI");
1740
   }
1734
   }
1741
1735
1742
   len += sprintf(buf+len, " ");
1736
   seq_printf(seqf, " ");
1743
1744
   return len;
1745
}
1737
}
1746
1738
1747
1739
(-)old/vmnet-only/hub.c (-50 / +50 lines)
Lines 25-30 Link Here
25
#include <linux/sched.h>
25
#include <linux/sched.h>
26
#include <linux/slab.h>
26
#include <linux/slab.h>
27
#include <linux/poll.h>
27
#include <linux/poll.h>
28
#include <linux/seq_file.h>
28
29
29
#include <linux/netdevice.h>
30
#include <linux/netdevice.h>
30
#include <linux/etherdevice.h>
31
#include <linux/etherdevice.h>
Lines 71-78 Link Here
71
static Bool VNetHubCycleDetect(VNetJack *this, int generation);
72
static Bool VNetHubCycleDetect(VNetJack *this, int generation);
72
static void VNetHubPortsChanged(VNetJack *this);
73
static void VNetHubPortsChanged(VNetJack *this);
73
static int  VNetHubIsBridged(VNetJack *this);
74
static int  VNetHubIsBridged(VNetJack *this);
74
static int  VNetHubProcRead(char *page, char **start, off_t off,
75
                            int count, int *eof, void *data);
76
75
77
static VNetHub *vnetHub = NULL;
76
static VNetHub *vnetHub = NULL;
78
77
Lines 244-249 Link Here
244
   return VNetHubAlloc(TRUE, -1, id);
243
   return VNetHubAlloc(TRUE, -1, id);
245
}
244
}
246
245
246
247
/*
248
 *----------------------------------------------------------------------
249
 *
250
 * VNetHubProcShow --
251
 *
252
 *      Callback for read operation on hub entry in vnets proc fs.
253
 *
254
 * Results:
255
 *      Length of read operation.
256
 *
257
 * Side effects:
258
 *      None.
259
 *
260
 *----------------------------------------------------------------------
261
 */
262
263
int
264
VNetHubProcShow(struct seq_file  *seqf,   // IN/OUT: buffer to write into
265
                void    *data)   // IN: client data - not used
266
{
267
   VNetJack *jack = (VNetJack*)data;
268
   VNetHub *hub;
269
270
   if (!jack || !jack->private) {
271
      return 0;
272
   }
273
   hub = (VNetHub*)jack->private;
274
275
   VNetPrintJack(jack, seqf);
276
277
   seq_printf(seqf, "tx %u ", hub->stats[jack->index].tx);
278
   seq_printf(seqf, "\n");
279
   return 0;
280
}
281
282
static int proc_hub_open(struct inode *inode, struct file *file)
283
{
284
       return single_open(file, VNetHubProcShow, PDE_DATA(inode));
285
}
286
287
static const struct file_operations proc_hub_fops = {
288
       .open           = proc_hub_open,
289
       .read           = seq_read,
290
       .llseek         = seq_lseek,
291
       .release        = seq_release,
292
};
293
247
/*
294
/*
248
 *----------------------------------------------------------------------
295
 *----------------------------------------------------------------------
249
 *
296
 *
Lines 360-366 Link Here
360
          * Make proc entry for this jack.
407
          * Make proc entry for this jack.
361
          */
408
          */
362
409
363
         retval = VNetProc_MakeEntry(jack->name, S_IFREG, &jack->procEntry);
410
         retval = VNetProc_MakeEntryOps(jack->name, S_IFREG, &jack->procEntry, &proc_hub_fops, jack);
364
         if (retval) {
411
         if (retval) {
365
            if (retval == -ENXIO) {
412
            if (retval == -ENXIO) {
366
               jack->procEntry = NULL;
413
               jack->procEntry = NULL;
Lines 368-376 Link Here
368
	       hub->used[i] = FALSE;
415
	       hub->used[i] = FALSE;
369
               return NULL;
416
               return NULL;
370
            }
417
            }
371
         } else {
372
            jack->procEntry->read_proc = VNetHubProcRead;
373
            jack->procEntry->data = jack;
374
         }
418
         }
375
419
376
         /*
420
         /*
Lines 691-737 Link Here
691
   return ret;
735
   return ret;
692
}
736
}
693
737
694
695
/*
696
 *----------------------------------------------------------------------
697
 *
698
 * VNetHubProcRead --
699
 *
700
 *      Callback for read operation on hub entry in vnets proc fs.
701
 *
702
 * Results:
703
 *      Length of read operation.
704
 *
705
 * Side effects:
706
 *      None.
707
 *
708
 *----------------------------------------------------------------------
709
 */
710
711
int
712
VNetHubProcRead(char    *page,   // IN/OUT: buffer to write into
713
                char   **start,  // OUT: 0 if file < 4k, else offset into page
714
                off_t    off,    // IN: offset of read into the file
715
                int      count,  // IN: maximum number of bytes to read
716
                int     *eof,    // OUT: TRUE if there is nothing more to read
717
                void    *data)   // IN: client data - not used
718
{
719
   VNetJack *jack = (VNetJack*)data;
720
   VNetHub *hub;
721
   int len = 0;
722
723
   if (!jack || !jack->private) {
724
      return len;
725
   }
726
   hub = (VNetHub*)jack->private;
727
728
   len += VNetPrintJack(jack, page+len);
729
730
   len += sprintf(page+len, "tx %u ", hub->stats[jack->index].tx);
731
732
   len += sprintf(page+len, "\n");
733
734
   *start = 0;
735
   *eof   = 1;
736
   return len;
737
}
(-)old/vmnet-only/netif.c (-50 / +49 lines)
Lines 69-77 Link Here
69
static void VNetNetifTxTimeout(struct net_device *dev);
69
static void VNetNetifTxTimeout(struct net_device *dev);
70
#endif
70
#endif
71
71
72
static int  VNetNetIfProcRead(char *page, char **start, off_t off,
73
                              int count, int *eof, void *data);
74
75
72
76
#if 0
73
#if 0
77
/*
74
/*
Lines 174-179 Link Here
174
#endif
171
#endif
175
}
172
}
176
173
174
/*
175
 *----------------------------------------------------------------------
176
 *
177
 * VNetNetIfProcShow --
178
 *
179
 *      Callback for read operation on this netif entry in vnets proc fs.
180
 *
181
 * Results: 
182
 *      Length of read operation.
183
 *
184
 * Side effects:
185
 *      None.
186
 *
187
 *----------------------------------------------------------------------
188
 */
189
190
int
191
VNetNetIfProcShow(struct seq_file *seqf, // IN/OUT: buffer to write into
192
                  void   *data)  // IN: client data
193
{
194
   VNetNetIF *netIf = data; 
195
   
196
   if (!netIf) {
197
      return 0;
198
   }
199
   
200
   VNetPrintPort(&netIf->port, seqf);
201
202
   seq_printf(seqf, "dev %s ", netIf->dev->name);
203
   
204
   seq_printf(seqf, "\n");
205
206
   return 0;
207
}
208
209
static int proc_netif_open(struct inode *inode, struct file *file)
210
{
211
       return single_open(file, VNetNetIfProcShow, PDE_DATA(inode));
212
}
213
214
static const struct file_operations proc_netif_fops = {
215
       .open           = proc_netif_open,
216
       .read           = seq_read,
217
       .llseek         = seq_lseek,
218
       .release        = seq_release,
219
};
220
177
221
178
/*
222
/*
179
 *----------------------------------------------------------------------
223
 *----------------------------------------------------------------------
Lines 262-269 Link Here
262
    * Make proc entry for this jack.
306
    * Make proc entry for this jack.
263
    */
307
    */
264
   
308
   
265
   retval = VNetProc_MakeEntry(netIf->port.jack.name, S_IFREG,
309
   retval = VNetProc_MakeEntryOps(netIf->port.jack.name, S_IFREG,
266
                               &netIf->port.jack.procEntry);
310
                               &netIf->port.jack.procEntry, &proc_netif_fops, netIf);
267
   if (retval) {
311
   if (retval) {
268
      if (retval == -ENXIO) {
312
      if (retval == -ENXIO) {
269
         netIf->port.jack.procEntry = NULL;
313
         netIf->port.jack.procEntry = NULL;
Lines 271-279 Link Here
271
         netIf->port.jack.procEntry = NULL;
315
         netIf->port.jack.procEntry = NULL;
272
         goto out;
316
         goto out;
273
      }
317
      }
274
   } else {
275
      netIf->port.jack.procEntry->read_proc = VNetNetIfProcRead;
276
      netIf->port.jack.procEntry->data = netIf;
277
   }
318
   }
278
319
279
   /*
320
   /*
Lines 658-702 Link Here
658
   return &netIf->stats;
699
   return &netIf->stats;
659
}
700
}
660
701
661
662
/*
663
 *----------------------------------------------------------------------
664
 *
665
 * VNetNetIfProcRead --
666
 *
667
 *      Callback for read operation on this netif entry in vnets proc fs.
668
 *
669
 * Results: 
670
 *      Length of read operation.
671
 *
672
 * Side effects:
673
 *      None.
674
 *
675
 *----------------------------------------------------------------------
676
 */
677
678
int
679
VNetNetIfProcRead(char   *page,  // IN/OUT: buffer to write into
680
                  char  **start, // OUT: 0 if file < 4k, else offset into page
681
                  off_t   off,   // IN: (unused) offset of read into the file
682
                  int     count, // IN: (unused) maximum number of bytes to read
683
                  int    *eof,   // OUT: TRUE if there is nothing more to read
684
                  void   *data)  // IN: client data
685
{
686
   VNetNetIF *netIf = (VNetNetIF*)data; 
687
   int len = 0;
688
   
689
   if (!netIf) {
690
      return len;
691
   }
692
   
693
   len += VNetPrintPort(&netIf->port, page+len);
694
695
   len += sprintf(page+len, "dev %s ", netIf->devName);
696
   
697
   len += sprintf(page+len, "\n");
698
699
   *start = 0;
700
   *eof   = 1;
701
   return len;
702
}
(-)old/vmnet-only/procfs.c (-90 / +16 lines)
Lines 45-54 Link Here
45
45
46
#if defined(CONFIG_PROC_FS)
46
#if defined(CONFIG_PROC_FS)
47
47
48
static int VNetProcMakeEntryInt(VNetProcEntry *parent, char *name, int mode,
49
                                VNetProcEntry **ret);
50
static void VNetProcRemoveEntryInt(VNetProcEntry *node, VNetProcEntry *parent);
51
52
static VNetProcEntry *base = NULL;
48
static VNetProcEntry *base = NULL;
53
49
54
50
Lines 71-77 Link Here
71
int
67
int
72
VNetProc_Init(void)
68
VNetProc_Init(void)
73
{
69
{
74
   return VNetProcMakeEntryInt(NULL, "vmnet", S_IFDIR, &base);
70
	base = proc_mkdir("vmnet", NULL);
71
	if(IS_ERR(base)) {
72
		base = NULL;
73
		return PTR_ERR(base);
74
	}
75
	return 0;
75
}
76
}
76
77
77
78
Lines 94-107 Link Here
94
void
95
void
95
VNetProc_Cleanup(void)
96
VNetProc_Cleanup(void)
96
{
97
{
97
   VNetProcRemoveEntryInt(base, NULL);
98
   proc_remove(base);
98
   base = NULL;
99
   base = NULL;
99
}
100
}
100
101
101
/*
102
/*
102
 *----------------------------------------------------------------------
103
 *----------------------------------------------------------------------
103
 *
104
 *
104
 * VNetProcMakeEntryInt --
105
 * VNetProc_MakeEntryOps --
105
 *
106
 *
106
 *      Make an entry in the vnets proc file system.
107
 *      Make an entry in the vnets proc file system.
107
 *
108
 *
Lines 116-128 Link Here
116
 */
117
 */
117
118
118
int
119
int
119
VNetProcMakeEntryInt(VNetProcEntry  *parent, // IN:
120
VNetProc_MakeEntryOps(char            *name,  // IN:
120
		     char            *name,  // IN:
121
		     int              mode,  // IN:
121
		     int              mode,  // IN:
122
		     VNetProcEntry  **ret)   // OUT:
122
		     VNetProcEntry  **ret,
123
             const struct file_operations *fops,
124
             void *data
125
             )   // OUT:
123
{
126
{
124
   VNetProcEntry *ent;
127
   VNetProcEntry *ent;
125
   ent = create_proc_entry(name, mode, parent);
128
   ent = proc_create_data(name, mode, base, fops, data);
126
   *ret = ent;
129
   *ret = ent;
127
   if (!ent)
130
   if (!ent)
128
      return -ENOMEM;
131
      return -ENOMEM;
Lines 133-190 Link Here
133
/*
136
/*
134
 *----------------------------------------------------------------------
137
 *----------------------------------------------------------------------
135
 *
138
 *
136
 * VNetProcRemoveEntryInt --
137
 *
138
 *      Remove a previously installed proc entry.
139
 *
140
 * Results: 
141
 *      None.
142
 *
143
 * Side effects:
144
 *      None.
145
 *
146
 *----------------------------------------------------------------------
147
 */
148
149
void
150
VNetProcRemoveEntryInt(VNetProcEntry *node,
151
                       VNetProcEntry *parent)
152
{
153
   if (node) {
154
      remove_proc_entry(node->name, parent);
155
   }
156
}
157
158
159
/*
160
 *----------------------------------------------------------------------
161
 *
162
 * VNetProc_MakeEntry --
163
 *
164
 *      Make an entry in the vnets proc file system.
165
 *
166
 * Results: 
167
 *      errno. If errno is 0 and ret is non NULL then ret is filled
168
 *      in with the resulting proc entry.
169
 *      
170
 * Side effects:
171
 *      None.
172
 *
173
 *----------------------------------------------------------------------
174
 */
175
176
int
177
VNetProc_MakeEntry(char            *name,  // IN:
178
		   int              mode,  // IN:
179
		   VNetProcEntry  **ret)   // OUT:
180
{
181
   return VNetProcMakeEntryInt(base, name, mode, ret);
182
}
183
184
185
/*
186
 *----------------------------------------------------------------------
187
 *
188
 * VNetProc_RemoveEntry --
139
 * VNetProc_RemoveEntry --
189
 *
140
 *
190
 *      Remove a previously installed proc entry.
141
 *      Remove a previously installed proc entry.
Lines 201-207 Link Here
201
void
152
void
202
VNetProc_RemoveEntry(VNetProcEntry *node)
153
VNetProc_RemoveEntry(VNetProcEntry *node)
203
{
154
{
204
   VNetProcRemoveEntryInt(node, base);
155
   if(node)
156
      proc_remove(node);
205
}
157
}
206
158
207
159
Lines 253-284 Link Here
253
}
205
}
254
206
255
207
256
/*
257
 *----------------------------------------------------------------------
258
 *
259
 * VNetProc_MakeEntry --
260
 *
261
 *      Make an entry in the vnets proc file system.
262
 *
263
 * Results: 
264
 *      errno. If errno is 0 and ret is non NULL then ret is filled
265
 *      in with the resulting proc entry.
266
 *      
267
 * Side effects:
268
 *      None.
269
 *
270
 *----------------------------------------------------------------------
271
 */
272
273
int
274
VNetProc_MakeEntry(char            *name,
275
                   int              mode,
276
                   VNetProcEntry  **ret)
277
{
278
   return -ENXIO;
279
}
280
281
282
/*
208
/*
283
 *----------------------------------------------------------------------
209
 *----------------------------------------------------------------------
284
 *
210
 *
(-)old/vmnet-only/userif.c (-22 / +22 lines)
Lines 433-439 Link Here
433
/*
433
/*
434
 *----------------------------------------------------------------------
434
 *----------------------------------------------------------------------
435
 *
435
 *
436
 * VNetUserIfProcRead --
436
 * VNetUserIfProcShow --
437
 *
437
 *
438
 *      Callback for read operation on this userif entry in vnets proc fs.
438
 *      Callback for read operation on this userif entry in vnets proc fs.
439
 *
439
 *
Lines 447-476 Link Here
447
 */
447
 */
448
448
449
static int
449
static int
450
VNetUserIfProcRead(char    *page,  // IN/OUT: buffer to write into
450
VNetUserIfProcShow(struct seq_file    *seqf,  // IN/OUT: buffer to write into
451
                   char   **start, // OUT: 0 if file < 4k, else offset into
452
                                   //      page
453
                   off_t    off,   // IN: offset of read into the file
454
                   int      count, // IN: maximum number of bytes to read
455
                   int     *eof,   // OUT: TRUE if there is nothing more to
456
                                   //      read
457
                   void    *data)  // IN: client data - not used
451
                   void    *data)  // IN: client data - not used
458
{
452
{
459
   VNetUserIF *userIf = (VNetUserIF*)data; 
453
   VNetUserIF *userIf = (VNetUserIF*)data; 
460
   int len = 0;
461
   
454
   
462
   if (!userIf) {
455
   if (!userIf) {
463
      return len;
456
      return 0;
464
   }
457
   }
465
   
458
   
466
   len += VNetPrintPort(&userIf->port, page+len);
459
   VNetPrintPort(&userIf->port, seqf);
467
   
460
   
468
   len += sprintf(page+len, "read %u written %u queued %u ",
461
   seq_printf(seqf, "read %u written %u queued %u ",
469
                  userIf->stats.read,
462
                  userIf->stats.read,
470
                  userIf->stats.written,
463
                  userIf->stats.written,
471
                  userIf->stats.queued);
464
                  userIf->stats.queued);
472
   
465
   
473
   len += sprintf(page+len, 
466
   seq_printf(seqf, 
474
		  "dropped.down %u dropped.mismatch %u "
467
		  "dropped.down %u dropped.mismatch %u "
475
		  "dropped.overflow %u dropped.largePacket %u",
468
		  "dropped.overflow %u dropped.largePacket %u",
476
                  userIf->stats.droppedDown,
469
                  userIf->stats.droppedDown,
Lines 478-490 Link Here
478
                  userIf->stats.droppedOverflow,
471
                  userIf->stats.droppedOverflow,
479
		  userIf->stats.droppedLargePacket);
472
		  userIf->stats.droppedLargePacket);
480
473
481
   len += sprintf(page+len, "\n");
474
   seq_printf(seqf, "\n");
482
   
475
   
483
   *start = 0;
476
   return 0;
484
   *eof   = 1;
477
}
485
   return len;
478
479
static int proc_userif_open(struct inode *inode, struct file *file)
480
{
481
   return single_open(file, VNetUserIfProcShow, PDE_DATA(inode));
486
}
482
}
487
483
484
static const struct file_operations proc_userif_fops = {
485
       .open           = proc_userif_open,
486
       .read           = seq_read,
487
       .llseek         = seq_lseek,
488
       .release        = seq_release,
489
};
490
488
491
489
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 4)
492
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 4)
490
/*
493
/*
Lines 1020-1027 Link Here
1020
    * Make proc entry for this jack.
1023
    * Make proc entry for this jack.
1021
    */
1024
    */
1022
   
1025
   
1023
   retval = VNetProc_MakeEntry(userIf->port.jack.name, S_IFREG,
1026
   retval = VNetProc_MakeEntryOps(userIf->port.jack.name, S_IFREG,
1024
                               &userIf->port.jack.procEntry);
1027
                               &userIf->port.jack.procEntry, &proc_userif_fops, userIf);
1025
   if (retval) {
1028
   if (retval) {
1026
      if (retval == -ENXIO) {
1029
      if (retval == -ENXIO) {
1027
         userIf->port.jack.procEntry = NULL;
1030
         userIf->port.jack.procEntry = NULL;
Lines 1029-1037 Link Here
1029
         kfree(userIf);
1032
         kfree(userIf);
1030
         return retval;
1033
         return retval;
1031
      }
1034
      }
1032
   } else {
1033
      userIf->port.jack.procEntry->read_proc = VNetUserIfProcRead;
1034
      userIf->port.jack.procEntry->data = userIf;
1035
   }
1035
   }
1036
1036
1037
   /*
1037
   /*
(-)old/vmnet-only/vnetInt.h (-4 / +6 lines)
Lines 169-180 Link Here
169
169
170
void VNetSend(const VNetJack *jack, struct sk_buff *skb);
170
void VNetSend(const VNetJack *jack, struct sk_buff *skb);
171
171
172
int VNetProc_MakeEntry(char *name, int mode,
172
int VNetProc_MakeEntryOps(char *name, int mode,
173
                       VNetProcEntry **ret);
173
                       VNetProcEntry **ret,
174
					   const struct file_operations *fops,
175
					   void *data);
174
176
175
void VNetProc_RemoveEntry(VNetProcEntry *node);
177
void VNetProc_RemoveEntry(VNetProcEntry *node);
176
178
177
int VNetPrintJack(const VNetJack *jack, char *buf);
179
void VNetPrintJack(const VNetJack *jack, struct seq_file *seqf);
178
180
179
int VNet_MakeMACAddress(VNetPort *port);
181
int VNet_MakeMACAddress(VNetPort *port);
180
182
Lines 193-199 Link Here
193
195
194
Bool VNetCycleDetectIf(const char *name, int generation);
196
Bool VNetCycleDetectIf(const char *name, int generation);
195
197
196
int VNetPrintPort(const VNetPort *port, char *buf);
198
void VNetPrintPort(const VNetPort *port, struct seq_file *seqf);
197
199
198
int VNetSnprintf(char *str, size_t size, const char *format, ...);
200
int VNetSnprintf(char *str, size_t size, const char *format, ...);
199
201

Return to bug 484844