Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 470896 | Differences between
and this patch

Collapse All | Expand All

(-)a/vmblock-only/linux/control.c (-4 / +4 lines)
Lines 208-216 SetupProcDevice(void) 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 SetupProcDevice(void) 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
(-)a/vmnet-only/bridge.c (-49 / +49 lines)
Lines 105-112 static Bool VNetBridgeCycleDetect(VNetJack *this, int generation); Link Here
105
static Bool VNetBridgeIsDeviceWireless(struct net_device *dev);
105
static Bool VNetBridgeIsDeviceWireless(struct net_device *dev);
106
static void VNetBridgePortsChanged(VNetJack *this);
106
static void VNetBridgePortsChanged(VNetJack *this);
107
static int  VNetBridgeIsBridged(VNetJack *this);
107
static int  VNetBridgeIsBridged(VNetJack *this);
108
static int  VNetBridgeProcRead(char *page, char **start, off_t off,
109
                               int count, int *eof, void *data);
110
static void VNetBridgeComputeHeaderPosIPv6(struct sk_buff *skb);
108
static void VNetBridgeComputeHeaderPosIPv6(struct sk_buff *skb);
111
static PacketStatus VNetCallSMACFunc(struct SMACState *state,
109
static PacketStatus VNetCallSMACFunc(struct SMACState *state,
112
                                     struct sk_buff **skb, void *startOfData,
110
                                     struct sk_buff **skb, void *startOfData,
Lines 225-230 VNetBridgeDevCompatible(VNetBridge *bridge, // IN: Bridge Link Here
225
/*
223
/*
226
 *----------------------------------------------------------------------
224
 *----------------------------------------------------------------------
227
 *
225
 *
226
 * VNetBridgeProcShow --
227
 *
228
 *      Callback for read operation on this bridge entry in vnets proc fs.
229
 *
230
 * Results:
231
 *      Length of read operation.
232
 *
233
 * Side effects:
234
 *      None.
235
 *
236
 *----------------------------------------------------------------------
237
 */
238
239
int
240
VNetBridgeProcShow(struct seq_file *seqf, // IN/OUT: buffer to write into
241
                   void    *data)   // IN: client data - pointer to bridge
242
{
243
   VNetBridge *bridge = (VNetBridge*)data;
244
245
   if (!bridge) {
246
      return 0;
247
   }
248
249
   VNetPrintPort(&bridge->port, seqf);
250
251
   seq_printf(seqf, "dev %s ", bridge->name);
252
253
   seq_printf(seqf, "\n");
254
255
   return 0;
256
}
257
258
static int proc_bridge_open(struct inode *inode, struct file *file)
259
{
260
       return single_open(file, VNetBridgeProcShow, PDE_DATA(inode));
261
}
262
263
static const struct file_operations proc_bridge_fops = {
264
       .open           = proc_bridge_open,
265
       .read           = seq_read,
266
       .llseek         = seq_lseek,
267
       .release        = seq_release,
268
};
269
270
/*
271
 *----------------------------------------------------------------------
272
 *
228
 * VNetBridge_Create --
273
 * VNetBridge_Create --
229
 *
274
 *
230
 *      Creates a bridge. Allocates struct, allocates internal device,
275
 *      Creates a bridge. Allocates struct, allocates internal device,
Lines 319-335 VNetBridge_Create(const char *devName, // IN: name of device (e.g., "eth0") Link Here
319
    * Make proc entry for this jack.
364
    * Make proc entry for this jack.
320
    */
365
    */
321
366
322
   retval = VNetProc_MakeEntry(bridge->port.jack.name, S_IFREG,
367
   retval = VNetProc_MakeEntryOps(bridge->port.jack.name, S_IFREG,
323
                               &bridge->port.jack.procEntry);
368
                               &bridge->port.jack.procEntry, &proc_bridge_fops, bridge);
324
   if (retval) {
369
   if (retval) {
325
      if (retval == -ENXIO) {
370
      if (retval == -ENXIO) {
326
         bridge->port.jack.procEntry = NULL;
371
         bridge->port.jack.procEntry = NULL;
327
      } else {
372
      } else {
328
         goto out;
373
         goto out;
329
      }
374
      }
330
   } else {
331
      bridge->port.jack.procEntry->read_proc = VNetBridgeProcRead;
332
      bridge->port.jack.procEntry->data = bridge;
333
   }
375
   }
334
376
335
   /*
377
   /*
Lines 1719-1763 VNetBridgeReceiveFromDev(struct sk_buff *skb, // IN: packet to receive Link Here
1719
   return 0;
1761
   return 0;
1720
}
1762
}
1721
1763
1722
1723
/*
1724
 *----------------------------------------------------------------------
1725
 *
1726
 * VNetBridgeProcRead --
1727
 *
1728
 *      Callback for read operation on this bridge entry in vnets proc fs.
1729
 *
1730
 * Results:
1731
 *      Length of read operation.
1732
 *
1733
 * Side effects:
1734
 *      None.
1735
 *
1736
 *----------------------------------------------------------------------
1737
 */
1738
1739
int
1740
VNetBridgeProcRead(char    *page,   // IN/OUT: buffer to write into
1741
                   char   **start,  // OUT: 0 if file < 4k, else offset into page
1742
                   off_t    off,    // IN: (unused) offset of read into the file
1743
                   int      count,  // IN: (unused) maximum number of bytes to read
1744
                   int     *eof,    // OUT: TRUE if there is nothing more to read
1745
                   void    *data)   // IN: client data - pointer to bridge
1746
{
1747
   VNetBridge *bridge = (VNetBridge*)data;
1748
   int len = 0;
1749
1750
   if (!bridge) {
1751
      return len;
1752
   }
1753
1754
   len += VNetPrintPort(&bridge->port, page+len);
1755
1756
   len += sprintf(page+len, "dev %s ", bridge->name);
1757
1758
   len += sprintf(page+len, "\n");
1759
1760
   *start = 0;
1761
   *eof   = 1;
1762
   return len;
1763
}
(-)a/vmnet-only/driver.c (-25 / +17 lines)
Lines 1775-1795 VNetSetMACUnique(VNetPort *port, // IN: Link Here
1775
 *----------------------------------------------------------------------
1775
 *----------------------------------------------------------------------
1776
 */
1776
 */
1777
1777
1778
int
1778
void
1779
VNetPrintJack(const VNetJack *jack, // IN: jack
1779
VNetPrintJack(const VNetJack *jack, // IN: jack
1780
              char           *buf)  // OUT: info about jack
1780
              struct seq_file *seqf)  // OUT: info about jack
1781
{
1781
{
1782
   int len = 0;
1783
1784
   read_lock(&vnetPeerLock);
1782
   read_lock(&vnetPeerLock);
1785
   if (!jack->peer) {
1783
   if (!jack->peer) {
1786
      len += sprintf(buf+len, "connected not ");
1784
      seq_printf(seqf, "connected not ");
1787
   } else {
1785
   } else {
1788
      len += sprintf(buf+len, "connected %s ", jack->peer->name);
1786
      seq_printf(seqf, "connected %s ", jack->peer->name);
1789
   }
1787
   }
1790
   read_unlock(&vnetPeerLock);
1788
   read_unlock(&vnetPeerLock);
1791
1792
   return len;
1793
}
1789
}
1794
1790
1795
1791
Lines 1809-1860 VNetPrintJack(const VNetJack *jack, // IN: jack Link Here
1809
 *----------------------------------------------------------------------
1805
 *----------------------------------------------------------------------
1810
 */
1806
 */
1811
1807
1812
int
1808
void
1813
VNetPrintPort(const VNetPort *port, // IN: port
1809
VNetPrintPort(const VNetPort *port, // IN: port
1814
              char           *buf)  // OUT: info about port
1810
              struct seq_file *seqf)  // OUT: info about port
1815
{
1811
{
1816
   int len = 0;
1812
   VNetPrintJack(&port->jack, seqf);
1817
1813
1818
   len += VNetPrintJack(&port->jack, buf+len);
1814
   seq_printf(seqf, "mac %02x:%02x:%02x:%02x:%02x:%02x ",
1819
1820
   len += sprintf(buf+len, "mac %02x:%02x:%02x:%02x:%02x:%02x ",
1821
                  port->paddr[0], port->paddr[1], port->paddr[2],
1815
                  port->paddr[0], port->paddr[1], port->paddr[2],
1822
                  port->paddr[3], port->paddr[4], port->paddr[5]);
1816
                  port->paddr[3], port->paddr[4], port->paddr[5]);
1823
1817
1824
   len += sprintf(buf+len, "ladrf %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",
1818
   seq_printf(seqf, "ladrf %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",
1825
                  port->ladrf[0], port->ladrf[1], port->ladrf[2],
1819
                  port->ladrf[0], port->ladrf[1], port->ladrf[2],
1826
                  port->ladrf[3], port->ladrf[4], port->ladrf[5],
1820
                  port->ladrf[3], port->ladrf[4], port->ladrf[5],
1827
                  port->ladrf[6], port->ladrf[7]);
1821
                  port->ladrf[6], port->ladrf[7]);
1828
1822
1829
   len += sprintf(buf+len, "flags IFF_RUNNING");
1823
   seq_printf(seqf, "flags IFF_RUNNING");
1830
1824
1831
   if (port->flags & IFF_UP) {
1825
   if (port->flags & IFF_UP) {
1832
      len += sprintf(buf+len, ",IFF_UP");
1826
      seq_printf(seqf, ",IFF_UP");
1833
   }
1827
   }
1834
1828
1835
   if (port->flags & IFF_BROADCAST) {
1829
   if (port->flags & IFF_BROADCAST) {
1836
      len += sprintf(buf+len, ",IFF_BROADCAST");
1830
      seq_printf(seqf, ",IFF_BROADCAST");
1837
   }
1831
   }
1838
1832
1839
   if (port->flags & IFF_DEBUG) {
1833
   if (port->flags & IFF_DEBUG) {
1840
      len += sprintf(buf+len, ",IFF_DEBUG");
1834
      seq_printf(seqf, ",IFF_DEBUG");
1841
   }
1835
   }
1842
1836
1843
   if (port->flags & IFF_PROMISC) {
1837
   if (port->flags & IFF_PROMISC) {
1844
      len += sprintf(buf+len, ",IFF_PROMISC");
1838
      seq_printf(seqf, ",IFF_PROMISC");
1845
   }
1839
   }
1846
1840
1847
   if (port->flags & IFF_MULTICAST) {
1841
   if (port->flags & IFF_MULTICAST) {
1848
      len += sprintf(buf+len, ",IFF_MULTICAST");
1842
      seq_printf(seqf, ",IFF_MULTICAST");
1849
   }
1843
   }
1850
1844
1851
   if (port->flags & IFF_ALLMULTI) {
1845
   if (port->flags & IFF_ALLMULTI) {
1852
      len += sprintf(buf+len, ",IFF_ALLMULTI");
1846
      seq_printf(seqf, ",IFF_ALLMULTI");
1853
   }
1847
   }
1854
1848
1855
   len += sprintf(buf+len, " ");
1849
   seq_printf(seqf, " ");
1856
1857
   return len;
1858
}
1850
}
1859
1851
1860
1852
(-)a/vmnet-only/hub.c (-49 / +49 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 static void VNetHubReceive(VNetJack *this, struct sk_buff *skb); 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;
76
static VNetHub *vnetHub;
78
static DEFINE_SPINLOCK(vnetHubLock);
77
static DEFINE_SPINLOCK(vnetHubLock);
Lines 241-246 VNetHub_AllocPvn(uint8 id[]) // IN: the PVN ID to alloc on Link Here
241
/*
240
/*
242
 *----------------------------------------------------------------------
241
 *----------------------------------------------------------------------
243
 *
242
 *
243
 * VNetHubProcShow --
244
 *
245
 *      Callback for read operation on hub entry in vnets proc fs.
246
 *
247
 * Results:
248
 *      Length of read operation.
249
 *
250
 * Side effects:
251
 *      None.
252
 *
253
 *----------------------------------------------------------------------
254
 */
255
256
int
257
VNetHubProcShow(struct seq_file  *seqf,   // IN/OUT: buffer to write into
258
                void    *data)   // IN: client data - not used
259
{
260
   VNetJack *jack = (VNetJack*)data;
261
   VNetHub *hub;
262
263
   if (!jack || !jack->private) {
264
      return 0;
265
   }
266
   hub = (VNetHub*)jack->private;
267
268
   VNetPrintJack(jack, seqf);
269
270
   seq_printf(seqf, "tx %u ", hub->stats[jack->index].tx);
271
   seq_printf(seqf, "\n");
272
   return 0;
273
}
274
275
static int proc_hub_open(struct inode *inode, struct file *file)
276
{
277
       return single_open(file, VNetHubProcShow, PDE_DATA(inode));
278
}
279
280
static const struct file_operations proc_hub_fops = {
281
       .open           = proc_hub_open,
282
       .read           = seq_read,
283
       .llseek         = seq_lseek,
284
       .release        = seq_release,
285
};
286
287
/*
288
 *----------------------------------------------------------------------
289
 *
244
 * VNetHubAlloc --
290
 * VNetHubAlloc --
245
 *
291
 *
246
 *      Allocate a jack on this hub.
292
 *      Allocate a jack on this hub.
Lines 354-360 VNetHubAlloc(Bool allocPvn, // IN: TRUE for PVN, FALSE for vnet Link Here
354
          * Make proc entry for this jack.
400
          * Make proc entry for this jack.
355
          */
401
          */
356
402
357
         retval = VNetProc_MakeEntry(jack->name, S_IFREG, &jack->procEntry);
403
         retval = VNetProc_MakeEntryOps(jack->name, S_IFREG, &jack->procEntry, &proc_hub_fops, jack);
358
         if (retval) {
404
         if (retval) {
359
            if (retval == -ENXIO) {
405
            if (retval == -ENXIO) {
360
               jack->procEntry = NULL;
406
               jack->procEntry = NULL;
Lines 362-370 VNetHubAlloc(Bool allocPvn, // IN: TRUE for PVN, FALSE for vnet Link Here
362
	       hub->used[i] = FALSE;
408
	       hub->used[i] = FALSE;
363
               return NULL;
409
               return NULL;
364
            }
410
            }
365
         } else {
366
            jack->procEntry->read_proc = VNetHubProcRead;
367
            jack->procEntry->data = jack;
368
         }
411
         }
369
412
370
         /*
413
         /*
Lines 686-731 VNetHubIsBridged(VNetJack *this) Link Here
686
}
729
}
687
730
688
731
689
/*
690
 *----------------------------------------------------------------------
691
 *
692
 * VNetHubProcRead --
693
 *
694
 *      Callback for read operation on hub entry in vnets proc fs.
695
 *
696
 * Results:
697
 *      Length of read operation.
698
 *
699
 * Side effects:
700
 *      None.
701
 *
702
 *----------------------------------------------------------------------
703
 */
704
705
int
706
VNetHubProcRead(char    *page,   // IN/OUT: buffer to write into
707
                char   **start,  // OUT: 0 if file < 4k, else offset into page
708
                off_t    off,    // IN: offset of read into the file
709
                int      count,  // IN: maximum number of bytes to read
710
                int     *eof,    // OUT: TRUE if there is nothing more to read
711
                void    *data)   // IN: client data - not used
712
{
713
   VNetJack *jack = (VNetJack*)data;
714
   VNetHub *hub;
715
   int len = 0;
716
717
   if (!jack || !jack->private) {
718
      return len;
719
   }
720
   hub = (VNetHub*)jack->private;
721
722
   len += VNetPrintJack(jack, page+len);
723
724
   len += sprintf(page+len, "tx %u ", hub->stats[jack->index].tx);
725
726
   len += sprintf(page+len, "\n");
727
728
   *start = 0;
729
   *eof   = 1;
730
   return len;
731
}
(-)a/vmnet-only/netif.c (-50 / +50 lines)
Lines 63-70 static int VNetNetifStartXmit(struct sk_buff *skb, struct net_device *dev); Link Here
63
static struct net_device_stats *VNetNetifGetStats(struct net_device *dev);
63
static struct net_device_stats *VNetNetifGetStats(struct net_device *dev);
64
static int  VNetNetifSetMAC(struct net_device *dev, void *addr);
64
static int  VNetNetifSetMAC(struct net_device *dev, void *addr);
65
static void VNetNetifSetMulticast(struct net_device *dev);
65
static void VNetNetifSetMulticast(struct net_device *dev);
66
static int  VNetNetIfProcRead(char *page, char **start, off_t off,
67
                              int count, int *eof, void *data);
68
66
69
/*
67
/*
70
 *----------------------------------------------------------------------
68
 *----------------------------------------------------------------------
Lines 117-122 VNetNetIfSetup(struct net_device *dev) // IN: Link Here
117
115
118
}
116
}
119
117
118
/*
119
 *----------------------------------------------------------------------
120
 *
121
 * VNetNetIfProcShow --
122
 *
123
 *      Callback for read operation on this netif entry in vnets proc fs.
124
 *
125
 * Results: 
126
 *      Length of read operation.
127
 *
128
 * Side effects:
129
 *      None.
130
 *
131
 *----------------------------------------------------------------------
132
 */
133
134
int
135
VNetNetIfProcShow(struct seq_file *seqf, // IN/OUT: buffer to write into
136
                  void   *data)  // IN: client data
137
{
138
   VNetNetIF *netIf = data; 
139
   
140
   if (!netIf) {
141
      return 0;
142
   }
143
   
144
   VNetPrintPort(&netIf->port, seqf);
145
146
   seq_printf(seqf, "dev %s ", netIf->dev->name);
147
   
148
   seq_printf(seqf, "\n");
149
150
   return 0;
151
}
152
153
static int proc_netif_open(struct inode *inode, struct file *file)
154
{
155
       return single_open(file, VNetNetIfProcShow, PDE_DATA(inode));
156
}
157
158
static const struct file_operations proc_netif_fops = {
159
       .open           = proc_netif_open,
160
       .read           = seq_read,
161
       .llseek         = seq_lseek,
162
       .release        = seq_release,
163
};
164
120
165
121
/*
166
/*
122
 *----------------------------------------------------------------------
167
 *----------------------------------------------------------------------
Lines 201-209 VNetNetIf_Create(char *devName, // IN: Link Here
201
   /*
246
   /*
202
    * Make proc entry for this jack.
247
    * Make proc entry for this jack.
203
    */
248
    */
204
   
249
  
205
   retval = VNetProc_MakeEntry(netIf->port.jack.name, S_IFREG,
250
   retval = VNetProc_MakeEntryOps(netIf->port.jack.name, S_IFREG,
206
                               &netIf->port.jack.procEntry);
251
                               &netIf->port.jack.procEntry, &proc_netif_fops, netIf);
207
   if (retval) {
252
   if (retval) {
208
      if (retval == -ENXIO) {
253
      if (retval == -ENXIO) {
209
         netIf->port.jack.procEntry = NULL;
254
         netIf->port.jack.procEntry = NULL;
Lines 211-219 VNetNetIf_Create(char *devName, // IN: Link Here
211
         netIf->port.jack.procEntry = NULL;
256
         netIf->port.jack.procEntry = NULL;
212
         goto out;
257
         goto out;
213
      }
258
      }
214
   } else {
215
      netIf->port.jack.procEntry->read_proc = VNetNetIfProcRead;
216
      netIf->port.jack.procEntry->data = netIf;
217
   }
259
   }
218
260
219
   /*
261
   /*
Lines 591-635 VNetNetifGetStats(struct net_device *dev) // IN: Link Here
591
   return &netIf->stats;
633
   return &netIf->stats;
592
}
634
}
593
635
594
595
/*
596
 *----------------------------------------------------------------------
597
 *
598
 * VNetNetIfProcRead --
599
 *
600
 *      Callback for read operation on this netif entry in vnets proc fs.
601
 *
602
 * Results: 
603
 *      Length of read operation.
604
 *
605
 * Side effects:
606
 *      None.
607
 *
608
 *----------------------------------------------------------------------
609
 */
610
611
int
612
VNetNetIfProcRead(char   *page,  // IN/OUT: buffer to write into
613
                  char  **start, // OUT: 0 if file < 4k, else offset into page
614
                  off_t   off,   // IN: (unused) offset of read into the file
615
                  int     count, // IN: (unused) maximum number of bytes to read
616
                  int    *eof,   // OUT: TRUE if there is nothing more to read
617
                  void   *data)  // IN: client data
618
{
619
   VNetNetIF *netIf = (VNetNetIF*)data; 
620
   int len = 0;
621
   
622
   if (!netIf) {
623
      return len;
624
   }
625
   
626
   len += VNetPrintPort(&netIf->port, page+len);
627
628
   len += sprintf(page+len, "dev %s ", netIf->devName);
629
   
630
   len += sprintf(page+len, "\n");
631
632
   *start = 0;
633
   *eof   = 1;
634
   return len;
635
}
(-)a/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 static VNetProcEntry *base = NULL; 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 VNetProc_Init(void) 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-187 VNetProc_Cleanup(void) 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;
129
   return 0;
132
   return 0;
130
}
133
}
131
134
132
133
/*
134
 *----------------------------------------------------------------------
135
 *
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
/*
135
/*
186
 *----------------------------------------------------------------------
136
 *----------------------------------------------------------------------
187
 *
137
 *
Lines 201-207 VNetProc_MakeEntry(char *name, // IN: Link Here
201
void
151
void
202
VNetProc_RemoveEntry(VNetProcEntry *node)
152
VNetProc_RemoveEntry(VNetProcEntry *node)
203
{
153
{
204
   VNetProcRemoveEntryInt(node, base);
154
	if(node)
155
		proc_remove(node);
205
}
156
}
206
157
207
158
Lines 253-283 VNetProc_Cleanup(void) Link Here
253
}
204
}
254
205
255
206
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
207
282
/*
208
/*
283
 *----------------------------------------------------------------------
209
 *----------------------------------------------------------------------
(-)a/vmnet-only/userif.c (-22 / +22 lines)
Lines 387-393 VNetUserIfReceive(VNetJack *this, // IN Link Here
387
/*
387
/*
388
 *----------------------------------------------------------------------
388
 *----------------------------------------------------------------------
389
 *
389
 *
390
 * VNetUserIfProcRead --
390
 * VNetUserIfProcShow --
391
 *
391
 *
392
 *      Callback for read operation on this userif entry in vnets proc fs.
392
 *      Callback for read operation on this userif entry in vnets proc fs.
393
 *
393
 *
Lines 401-430 VNetUserIfReceive(VNetJack *this, // IN Link Here
401
 */
401
 */
402
402
403
static int
403
static int
404
VNetUserIfProcRead(char    *page,  // IN/OUT: buffer to write into
404
VNetUserIfProcShow(struct seq_file    *seqf,  // IN/OUT: buffer to write into
405
                   char   **start, // OUT: 0 if file < 4k, else offset into
406
                                   //      page
407
                   off_t    off,   // IN: offset of read into the file
408
                   int      count, // IN: maximum number of bytes to read
409
                   int     *eof,   // OUT: TRUE if there is nothing more to
410
                                   //      read
411
                   void    *data)  // IN: client data - not used
405
                   void    *data)  // IN: client data - not used
412
{
406
{
413
   VNetUserIF *userIf = (VNetUserIF*)data; 
407
   VNetUserIF *userIf = (VNetUserIF*)data; 
414
   int len = 0;
415
   
408
   
416
   if (!userIf) {
409
   if (!userIf) {
417
      return len;
410
      return 0;
418
   }
411
   }
419
   
412
   
420
   len += VNetPrintPort(&userIf->port, page+len);
413
   VNetPrintPort(&userIf->port, seqf);
421
   
414
   
422
   len += sprintf(page+len, "read %u written %u queued %u ",
415
   seq_printf(seqf, "read %u written %u queued %u ",
423
                  userIf->stats.read,
416
                  userIf->stats.read,
424
                  userIf->stats.written,
417
                  userIf->stats.written,
425
                  userIf->stats.queued);
418
                  userIf->stats.queued);
426
   
419
   
427
   len += sprintf(page+len, 
420
   seq_printf(seqf, 
428
		  "dropped.down %u dropped.mismatch %u "
421
		  "dropped.down %u dropped.mismatch %u "
429
		  "dropped.overflow %u dropped.largePacket %u",
422
		  "dropped.overflow %u dropped.largePacket %u",
430
                  userIf->stats.droppedDown,
423
                  userIf->stats.droppedDown,
Lines 432-444 VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into Link Here
432
                  userIf->stats.droppedOverflow,
425
                  userIf->stats.droppedOverflow,
433
		  userIf->stats.droppedLargePacket);
426
		  userIf->stats.droppedLargePacket);
434
427
435
   len += sprintf(page+len, "\n");
428
   seq_printf(seqf, "\n");
436
   
429
   
437
   *start = 0;
430
   return 0;
438
   *eof   = 1;
431
}
439
   return len;
432
433
static int proc_userif_open(struct inode *inode, struct file *file)
434
{
435
       return single_open(file, VNetUserIfProcShow, PDE_DATA(inode));
440
}
436
}
441
437
438
static const struct file_operations proc_userif_fops = {
439
       .open           = proc_userif_open,
440
       .read           = seq_read,
441
       .llseek         = seq_lseek,
442
       .release        = seq_release,
443
};
444
442
445
443
/*
446
/*
444
 *----------------------------------------------------------------------
447
 *----------------------------------------------------------------------
Lines 1034-1041 VNetUserIf_Create(VNetPort **ret) // OUT Link Here
1034
    * Make proc entry for this jack.
1037
    * Make proc entry for this jack.
1035
    */
1038
    */
1036
   
1039
   
1037
   retval = VNetProc_MakeEntry(userIf->port.jack.name, S_IFREG,
1040
   retval = VNetProc_MakeEntryOps(userIf->port.jack.name, S_IFREG,
1038
                               &userIf->port.jack.procEntry);
1041
                               &userIf->port.jack.procEntry, &proc_userif_fops, userIf);
1039
   if (retval) {
1042
   if (retval) {
1040
      if (retval == -ENXIO) {
1043
      if (retval == -ENXIO) {
1041
         userIf->port.jack.procEntry = NULL;
1044
         userIf->port.jack.procEntry = NULL;
Lines 1043-1051 VNetUserIf_Create(VNetPort **ret) // OUT Link Here
1043
         kfree(userIf);
1046
         kfree(userIf);
1044
         return retval;
1047
         return retval;
1045
      }
1048
      }
1046
   } else {
1047
      userIf->port.jack.procEntry->read_proc = VNetUserIfProcRead;
1048
      userIf->port.jack.procEntry->data = userIf;
1049
   }
1049
   }
1050
1050
1051
   /*
1051
   /*
(-)a/vmnet-only/vnetInt.h (-4 / +6 lines)
Lines 171-182 VNetJack *VNetDisconnect(VNetJack *jack); Link Here
171
171
172
void VNetSend(const VNetJack *jack, struct sk_buff *skb);
172
void VNetSend(const VNetJack *jack, struct sk_buff *skb);
173
173
174
int VNetProc_MakeEntry(char *name, int mode,
174
int VNetProc_MakeEntryOps(char *name, int mode,
175
                       VNetProcEntry **ret);
175
                       VNetProcEntry **ret,
176
		       const struct file_operations *fops,
177
		       void *data);
176
178
177
void VNetProc_RemoveEntry(VNetProcEntry *node);
179
void VNetProc_RemoveEntry(VNetProcEntry *node);
178
180
179
int VNetPrintJack(const VNetJack *jack, char *buf);
181
void VNetPrintJack(const VNetJack *jack, struct seq_file *seqf);
180
182
181
int VNet_MakeMACAddress(VNetPort *port);
183
int VNet_MakeMACAddress(VNetPort *port);
182
184
Lines 196-202 Bool VNetPacketMatch(const uint8 *destAddr, const uint8 *ifAddr, Link Here
196
198
197
Bool VNetCycleDetectIf(const char *name, int generation);
199
Bool VNetCycleDetectIf(const char *name, int generation);
198
200
199
int VNetPrintPort(const VNetPort *port, char *buf);
201
void VNetPrintPort(const VNetPort *port, struct seq_file *seqf);
200
202
201
int VNetSnprintf(char *str, size_t size, const char *format, ...);
203
int VNetSnprintf(char *str, size_t size, const char *format, ...);
202
204

Return to bug 470896